[OpenWrt-Devel] [PATCH][umdns] Fix advertised IPv6 addresses

David Woodhouse dwmw2 at infradead.org
Mon Jun 8 11:48:38 EDT 2020


The dns_reply_a() function appears to include *only* link-local IPv6
addresses. This seems wrong, and ends up publishing addresses which
can't be used to reach the host in question.

I believe the logic should be the other way around and we should be
*eliding* the link-local addresses but including the global ones.

With this fixed, I can run 'ubus call umdns hosts' on another AP in my
network and I see the correct global IPv6 address. Likewise, running
'ubus call umdns browse' shows the right address and I can set about
fixing https://github.com/berlin-open-wireless-lab/DAWN/issues/95

Fixes: https://bugs.openwrt.org/index.php?do=details&task_id=3167

diff --git a/dns.c b/dns.c
index 1d3362f..47c75ad 100644
--- a/dns.c
+++ b/dns.c
@@ -202,7 +202,7 @@ dns_reply_a(struct interface *iface, struct sockaddr *to, int ttl)
 		if (ifa->ifa_addr->sa_family == AF_INET6) {
 			uint8_t ll_prefix[] = {0xfe, 0x80 };
 			sa6 = (struct sockaddr_in6 *) ifa->ifa_addr;
-			if (!memcmp(&sa6->sin6_addr, &ll_prefix, 2))
+			if (memcmp(&sa6->sin6_addr, &ll_prefix, 2))
 				dns_add_answer(TYPE_AAAA, (uint8_t *) &sa6->sin6_addr, 16, ttl);
 		}
 	}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5174 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200608/911cd4f3/attachment.bin>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list