mdns: Support queries in responses in mDNS non-strict mode

By default adds original queries to responses in order to be resolved by some resolvers, such as lwIP mdns library. This functionality however is discouraged by the RFC6762, so it could be disabled in menuconfig if MDNS_STRICT_MODE configured

Closes https://github.com/espressif/esp-idf/issues/5521


* Original commit: espressif/esp-idf@bcfa36db8f
This commit is contained in:
David Cermak
2020-07-28 09:06:12 +02:00
committed by suren-gabrielyan-espressif
parent 78f71ecdf6
commit 6021a88657
2 changed files with 27 additions and 0 deletions

View File

@ -1313,6 +1313,17 @@ static void _mdns_create_answer_from_parsed_packet(mdns_parsed_packet_t * parsed
_mdns_free_tx_packet(packet);
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;
}
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);
return;