Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Fix prefix invalidation via nd6_timer



details:   https://anonhg.NetBSD.org/src/rev/2f557bfc3de6
branches:  trunk
changeset: 821921:2f557bfc3de6
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Feb 22 03:02:55 2017 +0000

description:
Fix prefix invalidation via nd6_timer

We cannot remove a prefix there. Instead just invalidate it; the prefix
will be removed when purging an associated address. This is the same as
the original behavior.

diffstat:

 sys/netinet6/nd6.c     |  13 ++++++-------
 sys/netinet6/nd6.h     |   3 ++-
 sys/netinet6/nd6_rtr.c |  24 +++++++++++++++++-------
 3 files changed, 25 insertions(+), 15 deletions(-)

diffs (108 lines):

diff -r 0f00a2d81049 -r 2f557bfc3de6 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Wed Feb 22 02:58:31 2017 +0000
+++ b/sys/netinet6/nd6.c        Wed Feb 22 03:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.227 2017/02/14 03:05:06 ozaki-r Exp $        */
+/*     $NetBSD: nd6.c,v 1.228 2017/02/22 03:02:55 ozaki-r Exp $        */
 /*     $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.227 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.228 2017/02/22 03:02:55 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -715,13 +715,12 @@
                 */
                if (pr->ndpr_vltime != ND6_INFINITE_LIFETIME &&
                    time_uptime - pr->ndpr_lastupdate > pr->ndpr_vltime) {
-
                        /*
-                        * address expiration and prefix expiration are
-                        * separate.  NEVER perform in6_purgeaddr here.
+                        * Just invalidate the prefix here. Removing it
+                        * will be done when purging an associated address.
                         */
-
-                       nd6_prelist_remove(pr);
+                       KASSERT(pr->ndpr_refcnt > 0);
+                       nd6_invalidate_prefix(pr);
                }
        }
        ND6_UNLOCK();
diff -r 0f00a2d81049 -r 2f557bfc3de6 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Wed Feb 22 02:58:31 2017 +0000
+++ b/sys/netinet6/nd6.h        Wed Feb 22 03:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.h,v 1.82 2017/02/14 03:05:06 ozaki-r Exp $ */
+/*     $NetBSD: nd6.h,v 1.83 2017/02/22 03:02:55 ozaki-r Exp $ */
 /*     $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $    */
 
 /*
@@ -469,6 +469,7 @@
 void nd6_defrtrlist_del(struct nd_defrouter *, struct in6_ifextra *);
 void nd6_prefix_unref(struct nd_prefix *);
 void nd6_prelist_remove(struct nd_prefix *);
+void nd6_invalidate_prefix(struct nd_prefix *);
 void nd6_pfxlist_onlink_check(void);
 struct nd_defrouter *nd6_defrouter_lookup(const struct in6_addr *, struct ifnet *);
 void nd6_rt_flush(struct in6_addr *, struct ifnet *);
diff -r 0f00a2d81049 -r 2f557bfc3de6 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Wed Feb 22 02:58:31 2017 +0000
+++ b/sys/netinet6/nd6_rtr.c    Wed Feb 22 03:02:55 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_rtr.c,v 1.131 2017/01/16 15:44:47 christos Exp $   */
+/*     $NetBSD: nd6_rtr.c,v 1.132 2017/02/22 03:02:55 ozaki-r Exp $    */
 /*     $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $        */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.131 2017/01/16 15:44:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.132 2017/02/22 03:02:55 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1035,14 +1035,11 @@
 }
 
 void
-nd6_prelist_remove(struct nd_prefix *pr)
+nd6_invalidate_prefix(struct nd_prefix *pr)
 {
-       struct nd_pfxrouter *pfr, *next;
-       int e, s;
-       struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6];
+       int e;
 
        ND6_ASSERT_WLOCK();
-       KASSERT(pr->ndpr_refcnt == 0);
 
        /* make sure to invalidate the prefix until it is really freed. */
        pr->ndpr_vltime = 0;
@@ -1064,6 +1061,19 @@
                    pr->ndpr_plen, if_name(pr->ndpr_ifp), e);
                /* what should we do? */
        }
+}
+
+void
+nd6_prelist_remove(struct nd_prefix *pr)
+{
+       struct nd_pfxrouter *pfr, *next;
+       int s;
+       struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6];
+
+       ND6_ASSERT_WLOCK();
+       KASSERT(pr->ndpr_refcnt == 0);
+
+       nd6_invalidate_prefix(pr);
 
        s = splsoftnet();
        /* unlink ndpr_entry from nd_prefix list */



Home | Main Index | Thread Index | Old Index