improve route/nd cache cleanup on interface removal.
CAVEAT: haven't really tested it yet, please report
This commit is contained in:
parent
670eb236c0
commit
978ee2ed92
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=63241
22
sys/net/if.c
22
sys/net/if.c
@ -63,6 +63,8 @@
|
||||
#include <netinet/in_var.h>
|
||||
#ifdef INET6
|
||||
#include <machine/clock.h> /* XXX: temporal workaround for fxp issue */
|
||||
#include <netinet6/in6_var.h>
|
||||
#include <netinet6/in6_ifattach.h>
|
||||
#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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user