diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2003-07-08 10:23:33 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2003-07-08 10:23:33 +0000 |
commit | 1fa7f40ee5c48bd5214cd693bc53cf0b2d24d00c (patch) | |
tree | 97c60419c6bd5038c88376262740735a41a00cea /sys/netinet6 | |
parent | c61f99c80ad646351cdc82d3524cf64a3b1cfa3e (diff) |
on interface removal, clear multicast forwarding stuff. from kame
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 6 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 41 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.h | 3 |
3 files changed, 45 insertions, 5 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index ec27e31b48a..186e4cc6e50 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.34 2003/06/28 14:42:16 itojun Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.35 2003/07/08 10:23:32 itojun Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -53,6 +53,7 @@ #include <netinet6/in6_ifattach.h> #include <netinet6/ip6_var.h> #include <netinet6/nd6.h> +#include <netinet6/ip6_mroute.h> unsigned long in6_maxmtu = 0; @@ -658,6 +659,9 @@ in6_ifdetach(ifp) struct sockaddr_in6 sin6; struct in6_multi_mship *imm; + /* remove ip6_mrouter stuff */ + ip6_mrouter_detach(ifp); + /* remove neighbor management table */ nd6_purge(ifp); diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index af856a02e63..334f8da93b9 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.39 2003/06/24 07:47:54 itojun Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.40 2003/07/08 10:23:32 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ /* @@ -545,6 +545,38 @@ ip6_mrouter_done() return 0; } +void +ip6_mrouter_detach(ifp) + struct ifnet *ifp; +{ + struct rtdetq *rte; + struct mf6c *mfc; + mifi_t mifi; + int i; + + /* + * Delete a mif which points to ifp. + */ + for (mifi = 0; mifi < nummifs; mifi++) + if (mif6table[mifi].m6_ifp == ifp) + del_m6if(&mifi); + + /* + * Clear rte->ifp of cache entries received on ifp. + */ + for (i = 0; i < MF6CTBLSIZ; i++) { + if (n6expire[i] == 0) + continue; + + for (mfc = mf6ctable[i]; mfc != NULL; mfc = mfc->mf6c_next) { + for (rte = mfc->mf6c_stall; rte != NULL; rte = rte->next) { + if (rte->ifp == ifp) + rte->ifp = NULL; + } + } + } +} + static struct sockaddr_in6 sin6 = { sizeof(sin6), AF_INET6 }; /* @@ -768,7 +800,9 @@ add_m6fc(mfccp) /* free packets Qed at the end of this entry */ for (rte = rt->mf6c_stall; rte != NULL; ) { struct rtdetq *n = rte->next; - ip6_mdq(rte->m, rte->ifp, rt); + if (rte->ifp) { + ip6_mdq(rte->m, rte->ifp, rt); + } m_freem(rte->m); #ifdef UPCALL_TIMING collate(&(rte->t)); @@ -1313,7 +1347,8 @@ ip6_mdq(m, ifp, rt) log(LOG_DEBUG, "wrong if: ifid %d mifi %d mififid %x\n", ifp->if_index, mifi, - mif6table[mifi].m6_ifp->if_index); + mif6table[mifi].m6_ifp ? + mif6table[mifi].m6_ifp->if_index : -1); #endif mrt6stat.mrt6s_wrong_if++; rt->mf6c_wrong_if++; diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h index 2cf0723218c..81d67e187de 100644 --- a/sys/netinet6/ip6_mroute.h +++ b/sys/netinet6/ip6_mroute.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.h,v 1.5 2002/03/14 01:27:12 millert Exp $ */ +/* $OpenBSD: ip6_mroute.h,v 1.6 2003/07/08 10:23:32 itojun Exp $ */ /* $KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $ */ /* @@ -271,6 +271,7 @@ struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */ int ip6_mrouter_set(int, struct socket *, struct mbuf *); int ip6_mrouter_get(int, struct socket *, struct mbuf **); int ip6_mrouter_done(void); +void ip6_mrouter_detach(struct ifnet *); int mrt6_ioctl(int, caddr_t); #endif /* _KERNEL */ |