summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6.c
diff options
context:
space:
mode:
authorroy <roy@NetBSD.org>2014-12-16 11:42:27 +0000
committerroy <roy@NetBSD.org>2014-12-16 11:42:27 +0000
commit50e9fac786aec79eec00aa643f8ef98e5db2b0c7 (patch)
treee798152970dbda39858a23094327ba8b9b6530f1 /sys/netinet6/nd6.c
parent495545bb736d258c637edcf639bebfe9e228ae1c (diff)
Report route additions/changes/deletions for cached neighbours to userland.
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r--sys/netinet6/nd6.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 2ca862a2a62..4d29da3994b 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.155 2014/12/03 01:32:11 christos Exp $ */
+/* $NetBSD: nd6.c,v 1.156 2014/12/16 11:42:27 roy 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.155 2014/12/03 01:32:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.156 2014/12/16 11:42:27 roy Exp $");
#include "bridge.h"
#include "carp.h"
@@ -1037,6 +1037,7 @@ nd6_free(struct rtentry *rt, int gc)
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo, *next;
struct in6_addr in6 = satocsin6(rt_getkey(rt))->sin6_addr;
struct nd_defrouter *dr;
+ struct rtentry *oldrt;
/*
* we used to have pfctlinput(PRC_HOSTDEAD) here.
@@ -1129,7 +1130,15 @@ nd6_free(struct rtentry *rt, int gc)
* caches, and disable the route entry not to be used in already
* cached routes.
*/
- rtrequest(RTM_DELETE, rt_getkey(rt), NULL, rt_mask(rt), 0, NULL);
+ oldrt = NULL;
+ rtrequest(RTM_DELETE, rt_getkey(rt), NULL, rt_mask(rt), 0, &oldrt);
+ if (oldrt) {
+ nd6_rtmsg(RTM_DELETE, oldrt); /* tell user process */
+ if (oldrt->rt_refcnt <= 0) {
+ oldrt->rt_refcnt++;
+ rtfree(oldrt);
+ }
+ }
return next;
}
@@ -2059,6 +2068,9 @@ fail:
break;
}
+ if (do_update)
+ nd6_rtmsg(RTM_CHANGE, rt); /* tell user process */
+
/*
* When the link-layer address of a router changes, select the
* best router again. In particular, when the neighbor entry is newly