From 93c9036d4e293b2c94a04a6a51bb0cc778e0b373 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 21 Apr 2024 19:44:07 +0200 Subject: [PATCH] dns: reply to A/AAAA questions for additional hostnames Signed-off-by: John Crispin --- dns.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; }; } -- 2.30.2