From: John Crispin Date: Sun, 21 Apr 2024 17:44:07 +0000 (+0200) Subject: dns: reply to A/AAAA questions for additional hostnames X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=93c9036d4e293b2c94a04a6a51bb0cc778e0b373;p=project%2Fmdnsd.git dns: reply to A/AAAA questions for additional hostnames Signed-off-by: John Crispin --- diff --git a/dns.c b/dns.c index 2b5a390..f6f0be5 100644 --- a/dns.c +++ b/dns.c @@ -358,6 +358,7 @@ static void parse_question(struct interface *iface, struct sockaddr *from, char *name, struct dns_question *q) { struct sockaddr *to = NULL; + struct hostname *h; char *host; /* TODO: Multicast if more than one quarter of TTL has passed */ @@ -404,8 +405,15 @@ parse_question(struct interface *iface, struct sockaddr *from, char *name, struc host = strstr(name, ".local"); if (host) *host = '\0'; - if (!strcmp(umdns_host_label, name)) + if (!strcmp(umdns_host_label, name)) { dns_reply_a(iface, to, announce_ttl, NULL); + } else { + if (host) + *host = '.'; + vlist_for_each_element(&hostnames, h, node) + if (!strcmp(h->hostname, name)) + dns_reply_a(iface, to, announce_ttl, h->hostname); + } break; }; }