Module Name: src
Committed By: ozaki-r
Date: Wed Feb 22 03:02:55 UTC 2017
Modified Files:
src/sys/netinet6: nd6.c nd6.h nd6_rtr.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.82 -r1.83 src/sys/netinet6/nd6.h
cvs rdiff -u -r1.131 -r1.132 src/sys/netinet6/nd6_rtr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.227 src/sys/netinet6/nd6.c:1.228
--- src/sys/netinet6/nd6.c:1.227 Tue Feb 14 03:05:06 2017
+++ src/sys/netinet6/nd6.c Wed Feb 22 03:02:55 2017
@@ -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 @@ nd6_timer_work(struct work *wk, void *ar
*/
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();
Index: src/sys/netinet6/nd6.h
diff -u src/sys/netinet6/nd6.h:1.82 src/sys/netinet6/nd6.h:1.83
--- src/sys/netinet6/nd6.h:1.82 Tue Feb 14 03:05:06 2017
+++ src/sys/netinet6/nd6.h Wed Feb 22 03:02:55 2017
@@ -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_defrouter_select(void);
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 *);
Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.131 src/sys/netinet6/nd6_rtr.c:1.132
--- src/sys/netinet6/nd6_rtr.c:1.131 Mon Jan 16 15:44:47 2017
+++ src/sys/netinet6/nd6_rtr.c Wed Feb 22 03:02:55 2017
@@ -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 @@ nd6_prefix_unref(struct nd_prefix *pr)
}
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 @@ nd6_prelist_remove(struct nd_prefix *pr)
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 */