svn commit: r274346 - head/sys/netinet6

Andrey V. Elsukov ae at FreeBSD.org
Mon Nov 10 16:01:32 UTC 2014


Author: ae
Date: Mon Nov 10 16:01:31 2014
New Revision: 274346
URL: https://svnweb.freebsd.org/changeset/base/274346

Log:
  Remove link-local multicast routes remnants from in6_purgeaddr.
  Also merge in6_purgeaddr_mc with in6_purgeaddr.
  
  Sponsored by:	Yandex LLC

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Mon Nov 10 15:56:30 2014	(r274345)
+++ head/sys/netinet6/in6.c	Mon Nov 10 16:01:31 2014	(r274346)
@@ -1283,51 +1283,18 @@ in6_broadcast_ifa(struct ifnet *ifp, str
 	return (error);
 }
 
-/*
- * Leave from multicast groups we have joined for the interface.
- */
-static int
-in6_purgeaddr_mc(struct ifnet *ifp, struct in6_ifaddr *ia, struct ifaddr *ifa0)
-{
-	struct in6_multi_mship *imm;
-
-	while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) {
-		LIST_REMOVE(imm, i6mm_chain);
-		in6_leavegroup(imm);
-	}
-	return (0);
-}
-
 void
 in6_purgeaddr(struct ifaddr *ifa)
 {
 	struct ifnet *ifp = ifa->ifa_ifp;
 	struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa;
+	struct in6_multi_mship *imm;
 	int plen, error;
-	struct ifaddr *ifa0;
 
 	if (ifa->ifa_carp)
 		(*carp_detach_p)(ifa);
 
 	/*
-	 * find another IPv6 address as the gateway for the
-	 * link-local and node-local all-nodes multicast
-	 * address routes
-	 */
-	IF_ADDR_RLOCK(ifp);
-	TAILQ_FOREACH(ifa0, &ifp->if_addrhead, ifa_link) {
-		if ((ifa0->ifa_addr->sa_family != AF_INET6) ||
-		    memcmp(&satosin6(ifa0->ifa_addr)->sin6_addr,
-		    &ia->ia_addr.sin6_addr, sizeof(struct in6_addr)) == 0)
-			continue;
-		else
-			break;
-	}
-	if (ifa0 != NULL)
-		ifa_ref(ifa0);
-	IF_ADDR_RUNLOCK(ifp);
-
-	/*
 	 * Remove the loopback route to the interface address.
 	 * The check for the current setting of "nd6_useloopback"
 	 * is not needed.
@@ -1346,11 +1313,10 @@ in6_purgeaddr(struct ifaddr *ifa)
 	nd6_rem_ifa_lle(ia);
 
 	/* Leave multicast groups. */
-	error = in6_purgeaddr_mc(ifp, ia, ifa0);
-
-	if (ifa0 != NULL)
-		ifa_free(ifa0);
-
+	while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) {
+		LIST_REMOVE(imm, i6mm_chain);
+		in6_leavegroup(imm);
+	}
 	plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */
 	if ((ia->ia_flags & IFA_ROUTE) && plen == 128) {
 		error = rtinit(&(ia->ia_ifa), RTM_DELETE, ia->ia_flags |


More information about the svn-src-head mailing list