mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-30 18:57:28 +02:00
mdns: Allow resolve its own non-strict answers
the mDNS responder should not repeat questions when replying, however resolvers must ignore these questions field if they are present. esp-idf mDNS library does include questions in answering packets (thus not strictly following the RFC6762) so the resolver did not correctly resolved another instance host name. Closes https://github.com/espressif/esp-idf/issues/6190 * Original commit: espressif/esp-idf@0693e172de
This commit is contained in:
committed by
suren-gabrielyan-espressif
parent
becd5d0266
commit
89439e0a9b
@ -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;
|
goto clear_rx_packet;
|
||||||
} else if (header.answers || header.servers || header.additional) {
|
} else if (header.answers || header.servers || header.additional) {
|
||||||
uint16_t recordIndex = 0;
|
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)) {
|
if (parsed_packet->discovery && _mdns_name_is_discovery(name, type)) {
|
||||||
discovery = true;
|
discovery = true;
|
||||||
} else if (!name->sub && _mdns_name_is_ours(name)) {
|
} else {
|
||||||
|
if (!name->sub && _mdns_name_is_ours(name)) {
|
||||||
ours = true;
|
ours = true;
|
||||||
if (name->service && name->service[0] && name->proto && name->proto[0]) {
|
if (name->service && name->service[0] && name->proto && name->proto[0]) {
|
||||||
service = _mdns_get_service_item(name->service, name->proto);
|
service = _mdns_get_service_item(name->service, name->proto);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (header.questions || !parsed_packet->authoritative || record_type == MDNS_NS) {
|
if (!parsed_packet->authoritative || record_type == MDNS_NS) {
|
||||||
//skip this record
|
//skip this record
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user