diff options
Diffstat (limited to 'sys/netinet6/in6_ifattach.c')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 457e5ca197a..6e85d16d3d8 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.3 1999/12/10 12:34:45 itojun Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.4 2000/02/02 17:16:52 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -222,6 +222,10 @@ found: } } +/* + * XXX multiple loopback interface needs more care. for instance, + * nodelocal address needs to be configured onto only one of them. + */ void in6_ifattach(ifp, type, laddr, noloop) struct ifnet *ifp; @@ -609,6 +613,9 @@ in6_ifattach(ifp, type, laddr, noloop) return; } +/* + * NOTE: in6_ifdetach() does not support loopback if at this moment. + */ void in6_ifdetach(ifp) struct ifnet *ifp; @@ -617,6 +624,7 @@ in6_ifdetach(ifp) struct ifaddr *ifa; struct rtentry *rt; short rtflags; + struct sockaddr_in6 sin6; for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { @@ -660,4 +668,19 @@ in6_ifdetach(ifp) free(ia, M_IFADDR); } + + /* cleanup multicast address kludge table, if there is any */ + in6_purgemkludge(ifp); + + /* remove route to link-local allnodes multicast (ff02::1) */ + bzero(&sin6, sizeof(sin6)); + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_family = AF_INET6; + sin6.sin6_addr = in6addr_linklocal_allnodes; + sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index); + if ((rt = rtalloc1((struct sockaddr *)&sin6, 0)) != NULL) { + rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt), + rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0); + rtfree(rt); + } } |