Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/netinet6 Pull up revision 1.50 (requested by itojun...



details:   https://anonhg.NetBSD.org/src/rev/2410367bd677
branches:  netbsd-1-6
changeset: 530639:2410367bd677
user:      tron <tron%NetBSD.org@localhost>
date:      Mon Sep 01 07:40:02 2003 +0000

description:
Pull up revision 1.50 (requested by itojun in ticket #1375):
on interface detach, clear multicast forwarding table.  from kame

diffstat:

 sys/netinet6/ip6_mroute.c |  43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diffs (78 lines):

diff -r ddbecd67bd9f -r 2410367bd677 sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Mon Sep 01 07:39:51 2003 +0000
+++ b/sys/netinet6/ip6_mroute.c Mon Sep 01 07:40:02 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_mroute.c,v 1.28.4.2 2003/06/17 09:18:40 msaitoh Exp $      */
+/*     $NetBSD: ip6_mroute.c,v 1.28.4.3 2003/09/01 07:40:02 tron Exp $ */
 /*     $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $     */
 
 /*
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.28.4.2 2003/06/17 09:18:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.28.4.3 2003/09/01 07:40:02 tron Exp $");
 
 #include "opt_inet.h"
 
@@ -517,6 +517,38 @@
        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 };
 
 /*
@@ -739,7 +771,9 @@
                        /* 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));
@@ -1276,7 +1310,8 @@
                        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++;



Home | Main Index | Thread Index | Old Index