svn commit: r257082 - user/ae/inet6/sys/netinet6
Andrey V. Elsukov
ae at FreeBSD.org
Fri Oct 25 00:24:56 UTC 2013
Author: ae
Date: Fri Oct 25 00:24:55 2013
New Revision: 257082
URL: http://svnweb.freebsd.org/changeset/base/257082
Log:
Some cleanups in in6_ifdetach():
* remove in6_setscope() call;
* remove part of code, that already done in the in6_purgeaddr();
* don't remove route to multicast, we don't keep it.
Modified:
user/ae/inet6/sys/netinet6/in6_ifattach.c
Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6_ifattach.c Fri Oct 25 00:17:12 2013 (r257081)
+++ user/ae/inet6/sys/netinet6/in6_ifattach.c Fri Oct 25 00:24:55 2013 (r257082)
@@ -677,9 +677,6 @@ in6_nigroup0(struct ifnet *ifp, const ch
/* Copy the first 32 bits of 128-bit hash into the address. */
bcopy(digest, &in6->s6_addr32[3], sizeof(in6->s6_addr32[3]));
}
- if (in6_setscope(in6, ifp, NULL))
- return (-1); /* XXX: should not fail */
-
return 0;
}
@@ -790,12 +787,7 @@ in6_ifattach(struct ifnet *ifp, struct i
void
in6_ifdetach(struct ifnet *ifp)
{
- struct in6_ifaddr *ia;
struct ifaddr *ifa, *next;
- struct radix_node_head *rnh;
- struct rtentry *rt;
- struct sockaddr_in6 sin6;
- struct in6_multi_mship *imm;
if (ifp->if_afdata[AF_INET6] == NULL)
return;
@@ -810,39 +802,6 @@ in6_ifdetach(struct ifnet *ifp)
in6_purgeaddr(ifa);
}
- /* undo everything done by in6_ifattach(), just in case */
- TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) {
- if (ifa->ifa_addr->sa_family != AF_INET6
- || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) {
- continue;
- }
-
- ia = (struct in6_ifaddr *)ifa;
-
- /*
- * leave from multicast groups we have joined for the interface
- */
- while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) {
- LIST_REMOVE(imm, i6mm_chain);
- in6_leavegroup(imm);
- }
-
- /* Remove link-local from the routing table. */
- if (ia->ia_flags & IFA_ROUTE)
- (void)rtinit(&ia->ia_ifa, RTM_DELETE, ia->ia_flags);
-
- /* remove from the linked list */
- IF_ADDR_WLOCK(ifp);
- TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
- IF_ADDR_WUNLOCK(ifp);
- ifa_free(ifa); /* if_addrhead */
-
- IN6_IFADDR_WLOCK();
- TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link);
- IN6_IFADDR_WUNLOCK();
- ifa_free(ifa);
- }
-
in6_pcbpurgeif0(&V_udbinfo, ifp);
in6_pcbpurgeif0(&V_ripcbinfo, ifp);
/* leave from all multicast groups joined */
@@ -857,31 +816,6 @@ in6_ifdetach(struct ifnet *ifp)
* (Or can we just delay calling nd6_purge until at this point?)
*/
nd6_purge(ifp);
-
- /*
- * Remove route to link-local allnodes multicast (ff02::1).
- * These only get automatically installed for the default FIB.
- */
- bzero(&sin6, sizeof(sin6));
- sin6.sin6_len = sizeof(struct sockaddr_in6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = in6addr_linklocal_allnodes;
- if (in6_setscope(&sin6.sin6_addr, ifp, NULL))
- /* XXX: should not fail */
- return;
- /* XXX grab lock first to avoid LOR */
- rnh = rt_tables_get_rnh(RT_DEFAULT_FIB, AF_INET6);
- if (rnh != NULL) {
- RADIX_NODE_HEAD_LOCK(rnh);
- rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, RTF_RNH_LOCKED,
- RT_DEFAULT_FIB);
- if (rt) {
- if (rt->rt_ifp == ifp)
- rtexpunge(rt);
- RTFREE_LOCKED(rt);
- }
- RADIX_NODE_HEAD_UNLOCK(rnh);
- }
}
int
More information about the svn-src-user
mailing list