Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Get rid of extra nd6_purge from in6_ifdetach
details: https://anonhg.NetBSD.org/src/rev/70ade844b264
branches: trunk
changeset: 349692:70ade844b264
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Mon Dec 19 03:32:54 2016 +0000
description:
Get rid of extra nd6_purge from in6_ifdetach
There were two nd6_purge in in6_ifdetach for some reason, but at least now
We don't need extra nd6_purge. Remove it and instead add assertions that
check if surely purged.
diffstat:
sys/netinet6/in6_ifattach.c | 18 +++++-------------
sys/netinet6/nd6.c | 24 ++++++++++++++++++++++--
sys/netinet6/nd6.h | 3 ++-
3 files changed, 29 insertions(+), 16 deletions(-)
diffs (105 lines):
diff -r 5e14c5fc7107 -r 70ade844b264 sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c Mon Dec 19 03:19:37 2016 +0000
+++ b/sys/netinet6/in6_ifattach.c Mon Dec 19 03:32:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_ifattach.c,v 1.107 2016/11/30 02:08:57 ozaki-r Exp $ */
+/* $NetBSD: in6_ifattach.c,v 1.108 2016/12/19 03:32:54 ozaki-r Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.107 2016/11/30 02:08:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.108 2016/12/19 03:32:54 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -815,21 +815,13 @@
/* remove ip6_mrouter stuff */
ip6_mrouter_detach(ifp);
- /* remove neighbor management table */
- nd6_purge(ifp, NULL);
-
/* cleanup multicast address kludge table, if there is any */
in6_purgemkludge(ifp);
- /*
- * remove neighbor management table. we call it twice just to make
- * sure we nuke everything. maybe we need just one call.
- * XXX: since the first call did not release addresses, some prefixes
- * might remain. We should call nd6_purge() again to release the
- * prefixes after removing all addresses above.
- * (Or can we just delay calling nd6_purge until at this point?)
- */
+ /* remove neighbor management table */
nd6_purge(ifp, NULL);
+
+ nd6_assert_purged(ifp);
}
int
diff -r 5e14c5fc7107 -r 70ade844b264 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c Mon Dec 19 03:19:37 2016 +0000
+++ b/sys/netinet6/nd6.c Mon Dec 19 03:32:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.217 2016/12/14 04:05:11 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.218 2016/12/19 03:32:54 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.217 2016/12/14 04:05:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.218 2016/12/19 03:32:54 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -906,6 +906,26 @@
lltable_purge_entries(ext->lltable);
}
+void
+nd6_assert_purged(struct ifnet *ifp)
+{
+ struct nd_defrouter *dr;
+ struct nd_prefix *pr;
+
+ ND_DEFROUTER_LIST_FOREACH(dr) {
+ KASSERTMSG(dr->ifp != ifp,
+ "defrouter %s remains on %s",
+ ip6_sprintf(&dr->rtaddr), ifp->if_xname);
+ }
+
+ ND_PREFIX_LIST_FOREACH(pr) {
+ KASSERTMSG(pr->ndpr_ifp != ifp,
+ "prefix %s/%d remains on %s",
+ ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen, ifp->if_xname);
+ }
+}
+
struct llentry *
nd6_lookup(const struct in6_addr *addr6, const struct ifnet *ifp, bool wlock)
{
diff -r 5e14c5fc7107 -r 70ade844b264 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h Mon Dec 19 03:19:37 2016 +0000
+++ b/sys/netinet6/nd6.h Mon Dec 19 03:32:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.79 2016/12/14 04:05:11 ozaki-r Exp $ */
+/* $NetBSD: nd6.h,v 1.80 2016/12/19 03:32:54 ozaki-r Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -428,6 +428,7 @@
void nd6_setmtu(struct ifnet *);
void nd6_llinfo_settimer(struct llentry *, time_t);
void nd6_purge(struct ifnet *, struct in6_ifextra *);
+void nd6_assert_purged(struct ifnet *);
void nd6_nud_hint(struct rtentry *);
int nd6_resolve(struct ifnet *, struct rtentry *,
struct mbuf *, struct sockaddr *, u_char *);
Home |
Main Index |
Thread Index |
Old Index