Skip to content

Commit 7e82a7c

Browse files
gjc13suren-gabrielyan-espressif
authored andcommitted
mdns: filter instance name for ANY queries
The instance name in ANY quries was ignored. The MR fixes the issue. * Original commit: espressif/esp-idf@5d0c473
1 parent ae381b7 commit 7e82a7c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

components/mdns/mdns.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,8 @@ static bool _mdns_service_match_ptr_question(const mdns_service_t *service, cons
15401540
if (!_mdns_service_match(service, question->service, question->proto, NULL)) {
15411541
return false;
15421542
}
1543+
// The question parser stores anything before _type._proto in question->host
1544+
// So the question->host can be subtype or instance name based on its content
15431545
if (question->sub) {
15441546
mdns_subtype_t *subtype = service->subtype;
15451547
while (subtype) {
@@ -1550,6 +1552,11 @@ static bool _mdns_service_match_ptr_question(const mdns_service_t *service, cons
15501552
}
15511553
return false;
15521554
}
1555+
if (question->host) {
1556+
if (strcasecmp(service->instance, question->host) != 0) {
1557+
return false;
1558+
}
1559+
}
15531560
return true;
15541561
}
15551562

0 commit comments

Comments
 (0)