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

mdns: Allow resolve (it's own) non-strict answers (v4.2)

See merge request espressif/esp-idf!11818
This commit is contained in:
David Čermák 2021-01-15 19:51:04 +08:00
commit 7ff123562b

View File

@ -2753,7 +2753,7 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
}
}
if (header.questions && !parsed_packet->questions && !parsed_packet->discovery) {
if (header.questions && !parsed_packet->questions && !parsed_packet->discovery && !header.answers) {
goto clear_rx_packet;
} else if (header.answers || header.servers || header.additional) {
uint16_t recordIndex = 0;
@ -2796,13 +2796,14 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
if (parsed_packet->discovery && _mdns_name_is_discovery(name, type)) {
discovery = true;
} else if (!name->sub && _mdns_name_is_ours(name)) {
ours = true;
if (name->service && name->service[0] && name->proto && name->proto[0]) {
service = _mdns_get_service_item(name->service, name->proto);
}
} else {
if (header.questions || !parsed_packet->authoritative || record_type == MDNS_NS) {
if (!name->sub && _mdns_name_is_ours(name)) {
ours = true;
if (name->service && name->service[0] && name->proto && name->proto[0]) {
service = _mdns_get_service_item(name->service, name->proto);
}
}
if (!parsed_packet->authoritative || record_type == MDNS_NS) {
//skip this record
continue;
}