version 1.29, 2000/04/27 15:39:05 |
version 1.30, 2000/05/05 08:03:12 |
|
|
/* $NetBSD$ */ |
/* $NetBSD$ */ |
/* $KAME: in6_ifattach.c,v 1.53 2000/04/16 14:01:42 itojun Exp $ */ |
/* $KAME: in6_ifattach.c,v 1.56 2000/05/05 06:54:33 itojun Exp $ */ |
|
|
/* |
/* |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
Line 793 in6_ifdetach(ifp) |
|
Line 793 in6_ifdetach(ifp) |
|
struct ifnet *ifp; |
struct ifnet *ifp; |
{ |
{ |
struct in6_ifaddr *ia, *oia; |
struct in6_ifaddr *ia, *oia; |
struct ifaddr *ifa; |
struct ifaddr *ifa, *next; |
struct rtentry *rt; |
struct rtentry *rt; |
short rtflags; |
short rtflags; |
struct sockaddr_in6 sin6; |
struct sockaddr_in6 sin6; |
Line 804 in6_ifdetach(ifp) |
|
Line 804 in6_ifdetach(ifp) |
|
/* remove neighbor management table */ |
/* remove neighbor management table */ |
nd6_purge(ifp); |
nd6_purge(ifp); |
|
|
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) |
/* nuke any of IPv6 addresses we have */ |
|
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) |
|
{ |
|
next = ifa->ifa_list.tqe_next; |
|
if (ifa->ifa_addr->sa_family != AF_INET6) |
|
continue; |
|
in6_purgeaddr(ifa, ifp); |
|
} |
|
|
|
/* undo everything done by in6_ifattach(), just in case */ |
|
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = next) |
{ |
{ |
|
next = ifa->ifa_list.tqe_next; |
|
|
|
|
if (ifa->ifa_addr->sa_family != AF_INET6 |
if (ifa->ifa_addr->sa_family != AF_INET6 |
|| !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { |
|| !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { |
continue; |
continue; |
Line 827 in6_ifdetach(ifp) |
|
Line 840 in6_ifdetach(ifp) |
|
|
|
/* remove from the linked list */ |
/* remove from the linked list */ |
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); |
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list); |
|
IFAFREE(&ia->ia_ifa); |
|
|
/* also remove from the IPv6 address chain(itojun&jinmei) */ |
/* also remove from the IPv6 address chain(itojun&jinmei) */ |
oia = ia; |
oia = ia; |
Line 844 in6_ifdetach(ifp) |
|
Line 858 in6_ifdetach(ifp) |
|
#endif |
#endif |
} |
} |
|
|
free(oia, M_IFADDR); |
IFAFREE(&oia->ia_ifa); |
} |
} |
|
|
/* cleanup multicast address kludge table, if there is any */ |
/* cleanup multicast address kludge table, if there is any */ |
in6_purgemkludge(ifp); |
in6_purgemkludge(ifp); |
|
|
|
/* remove neighbor management table */ |
|
nd6_purge(ifp); |
|
|
/* remove route to link-local allnodes multicast (ff02::1) */ |
/* remove route to link-local allnodes multicast (ff02::1) */ |
bzero(&sin6, sizeof(sin6)); |
bzero(&sin6, sizeof(sin6)); |
sin6.sin6_len = sizeof(struct sockaddr_in6); |
sin6.sin6_len = sizeof(struct sockaddr_in6); |