aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2014-10-30 12:44:46 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2014-10-30 12:44:46 +0000
commit94a43496c2f86dfd6cad106402f23f06229930f7 (patch)
treeae4d112c2f279447b1f94a8281b42d60757277fa /sys/netinet6
parent3c268b3afc189559f85fd5668891b20b4cdcd10b (diff)
downloadsrc-94a43496c2f86dfd6cad106402f23f06229930f7.tar.gz
src-94a43496c2f86dfd6cad106402f23f06229930f7.zip
Remove redundant code.
if_detach already did these steps. Also, now we didn't keep routes to link-local addresses. Obtained from: Yandex LLC Sponsored by: Yandex LLC
Notes
Notes: svn path=/head/; revision=273858
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_ifattach.c69
1 files changed, 4 insertions, 65 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 6eb737e813a1..e0ddf22337e5 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -775,12 +775,7 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
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;
@@ -788,46 +783,15 @@ in6_ifdetach(struct ifnet *ifp)
/* remove neighbor management table */
nd6_purge(ifp);
- /* nuke any of IPv6 addresses we have */
+ /*
+ * nuke any of IPv6 addresses we have
+ * XXX: all addresses should be already removed
+ */
TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
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_ulitecbinfo, ifp);
in6_pcbpurgeif0(&V_ripcbinfo, ifp);
@@ -843,31 +807,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)
- rt_expunge(rnh, rt);
- RTFREE_LOCKED(rt);
- }
- RADIX_NODE_HEAD_UNLOCK(rnh);
- }
}
int