tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SIOCSRTRFLUSH_IN6 and SIOCSPFXFLUSH_IN6



On 14/12/2018 16:48, Roy Marples wrote:
Fixing this should be straight forward, but my concern is that with dhcp sending the interface name "dummy0" which is not meant to exist would break binary compat as ideally a NULL parameter should be sent - dummy0 could be a real interface one day.

Turns out it is quite easy really and is backwards compat.
Hopefully Greg can test it fixes the issue and I'll commit it.
I'll also adjust ndp and dhcpcd to use in6_ifreq as that's what the ioctl really expects.

Roy
Index: sys/netinet6/nd6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/nd6.c,v
retrieving revision 1.251
diff -u -p -r1.251 nd6.c
--- sys/netinet6/nd6.c	30 Oct 2018 05:54:41 -0000	1.251
+++ sys/netinet6/nd6.c	14 Dec 2018 21:25:30 -0000
@@ -1884,6 +1884,10 @@ nd6_ioctl(u_long cmd, void *data, struct
 			struct in6_ifaddr *ia, *ia_next;
 			int _s;
 
+			/* Only flush prefixes for the given interface. */
+			if (ifp != lo0ifp && ifp != pfx->ndpr_ifp)
+				continue;
+
 			if (IN6_IS_ADDR_LINKLOCAL(&pfx->ndpr_prefix.sin6_addr))
 				continue; /* XXX */
 
@@ -1953,8 +1957,15 @@ nd6_ioctl(u_long cmd, void *data, struct
 		struct nd_defrouter *drtr, *next;
 
 		ND6_WLOCK();
+#if 0
+		/* XXX Is this really needed? */
 		nd6_defrouter_reset();
+#endif
 		ND_DEFROUTER_LIST_FOREACH_SAFE(drtr, next) {
+			/* Only flush routers for the given interface. */
+			if (ifp != lo0ifp && ifp != drtr->ifp)
+				continue;
+
 			nd6_defrtrlist_del(drtr, NULL);
 		}
 		nd6_defrouter_select();


Home | Main Index | Thread Index | Old Index