From 49e23035495c71ea37a348318d58152951a591df Mon Sep 17 00:00:00 2001 From: itojun Date: Sun, 16 Jul 2000 01:46:42 +0000 Subject: improve route/nd cache cleanup on interface removal. CAVEAT: haven't really tested it yet, please report --- sys/net/if.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'sys/net') diff --git a/sys/net/if.c b/sys/net/if.c index 2dce111..d7feb3c 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -63,6 +63,8 @@ #include #ifdef INET6 #include /* XXX: temporal workaround for fxp issue */ +#include +#include #endif #endif @@ -260,19 +262,10 @@ if_detach(ifp) } #endif /* INET */ #ifdef INET6 - /* XXX: Ugly!! ad hoc just for INET6 */ if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET6) { - struct in6_aliasreq ifr; - - bzero(&ifr, sizeof(ifr)); - ifr.ifra_addr = - *((struct sockaddr_in6 *)ifa->ifa_addr); - if (ifa->ifa_dstaddr) - ifr.ifra_dstaddr = - *((struct sockaddr_in6 *)ifa->ifa_dstaddr); - if (in6_control(NULL, SIOCDIFADDR_IN6, (caddr_t)&ifr, - ifp, NULL) == 0) - continue; + in6_purgeaddr(ifa, ifp); + /* ifp_addrhead is already updated */ + continue; } #endif /* INET6 */ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); @@ -291,6 +284,11 @@ if_detach(ifp) (void) rnh->rnh_walktree(rnh, if_rtdel, ifp); } +#ifdef INET6 + /* nuke all IPv6 kernel structs related to ifp */ + in6_ifdetach(ifp); +#endif + TAILQ_REMOVE(&ifnet, ifp, if_link); splx(s); } -- cgit v1.1