Merge branch 'bugfix/mdns_one_shot_multicast_v4.2' into 'release/v4.2'

mdns: Support for One-Shot mDNS queries (v4.2)

See merge request espressif/esp-idf!14131
This commit is contained in:
David Čermák 2021-06-24 18:48:23 +00:00
commit 93921e042c

View File

@ -1325,15 +1325,17 @@ static void _mdns_create_answer_from_parsed_packet(mdns_parsed_packet_t * parsed
return;
}
#ifdef MDNS_REPEAT_QUERY_IN_RESPONSE
mdns_out_question_t * out_question = malloc(sizeof(mdns_out_question_t));
if (out_question == NULL) {
HOOK_MALLOC_FAILED;
_mdns_free_tx_packet(packet);
return;
if (parsed_packet->src_port != MDNS_SERVICE_PORT) {
mdns_out_question_t * out_question = malloc(sizeof(mdns_out_question_t));
if (out_question == NULL) {
HOOK_MALLOC_FAILED;
_mdns_free_tx_packet(packet);
return;
}
memcpy(out_question, q, sizeof(mdns_out_question_t));
out_question->next = NULL;
queueToEnd(mdns_out_question_t, packet->questions, out_question);
}
memcpy(out_question, q, sizeof(mdns_out_question_t));
out_question->next = NULL;
queueToEnd(mdns_out_question_t, packet->questions, out_question);
#endif // MDNS_REPEAT_QUERY_IN_RESPONSE
} else if (!_mdns_alloc_answer(&packet->answers, q->type, NULL, send_flush, false)) {
_mdns_free_tx_packet(packet);