shithub: riscv

Download patch

ref: b9b6fcd85fc186e3f7f9cc780272137499a9b3a1
parent: fca2c1cb3192fa149fc5f41646959ea2bdc5806c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jun 12 15:36:31 EDT 2018

ip/dhcp6d: only announce all-dhcp-servers multicast address on interface with link-local address on it

--- a/sys/src/cmd/ip/dhcp6d.c
+++ b/sys/src/cmd/ip/dhcp6d.c
@@ -134,6 +134,7 @@
 	int fd, cfd;
 	char data[128], devdir[40];
 	Ipifc *ifc;
+	Iplifc *lifc;
 
 	sprint(data, "%s/udp!*!dhcp6s", net);
 	cfd = announce(data, devdir);
@@ -144,12 +145,14 @@
 
 	ipifcs = readipifc(net, ipifcs, -1);
 	for(ifc = ipifcs; ifc != nil; ifc = ifc->next){
-		if(ifc->lifc == nil)
-			continue;
 		if(strcmp(ifc->dev, "/dev/null") == 0)
 			continue;
-		if(fprint(cfd, "addmulti %I ff02::1:2", ifc->lifc->ip) < 0)
-			fprint(2, "can't add interface %s: %r", ifc->dev);
+		for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next){
+			if(ISIPV6LINKLOCAL(lifc->ip))
+				continue;
+			if(fprint(cfd, "addmulti %I ff02::1:2", lifc->ip) < 0)
+				fprint(2, "addmulti: %I: %r\n", lifc->ip);
+		}
 	}
 
 	sprint(data, "%s/data", devdir);