Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Report route additions/changes/deletions for ca...
details: https://anonhg.NetBSD.org/src/rev/889cd03b8364
branches: trunk
changeset: 805082:889cd03b8364
user: roy <roy%NetBSD.org@localhost>
date: Tue Dec 16 11:42:27 2014 +0000
description:
Report route additions/changes/deletions for cached neighbours to userland.
diffstat:
sys/netinet6/nd6.c | 18 +++++++++++++++---
sys/netinet6/nd6.h | 3 ++-
sys/netinet6/nd6_nbr.c | 13 +++++++++----
sys/netinet6/nd6_rtr.c | 7 +++----
4 files changed, 29 insertions(+), 12 deletions(-)
diffs (170 lines):
diff -r 43a2a0640ef1 -r 889cd03b8364 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c Tue Dec 16 11:34:17 2014 +0000
+++ b/sys/netinet6/nd6.c Tue Dec 16 11:42:27 2014 +0000
@@ -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 @@
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 @@
* 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 @@
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
diff -r 43a2a0640ef1 -r 889cd03b8364 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h Tue Dec 16 11:34:17 2014 +0000
+++ b/sys/netinet6/nd6.h Tue Dec 16 11:42:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.60 2014/09/05 06:08:15 matt Exp $ */
+/* $NetBSD: nd6.h,v 1.61 2014/12/16 11:42:27 roy Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -413,6 +413,7 @@
struct nd_opt_hdr *nd6_option(union nd_opts *);
int nd6_options(union nd_opts *);
struct rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *);
+void nd6_rtmsg(int, struct rtentry *);
void nd6_setmtu(struct ifnet *);
void nd6_llinfo_settimer(struct llinfo_nd6 *, long);
void nd6_timer(void *);
diff -r 43a2a0640ef1 -r 889cd03b8364 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c Tue Dec 16 11:34:17 2014 +0000
+++ b/sys/netinet6/nd6_nbr.c Tue Dec 16 11:42:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_nbr.c,v 1.102 2014/10/12 20:05:50 roy Exp $ */
+/* $NetBSD: nd6_nbr.c,v 1.103 2014/12/16 11:42:27 roy Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.102 2014/10/12 20:05:50 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.103 2014/12/16 11:42:27 roy Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -567,6 +567,7 @@
struct sockaddr_dl *sdl;
union nd_opts ndopts;
struct sockaddr_in6 ssin6;
+ int rt_announce;
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
@@ -669,6 +670,7 @@
((sdl = satosdl(rt->rt_gateway)) == NULL))
goto freeit;
+ rt_announce = 0;
if (ln->ln_state == ND6_LLINFO_INCOMPLETE) {
/*
* If the link-layer has address, and no lladdr option came,
@@ -682,6 +684,7 @@
*/
(void)sockaddr_dl_setaddr(sdl, sdl->sdl_len, lladdr,
ifp->if_addrlen);
+ rt_announce = 1;
if (is_solicited) {
ln->ln_state = ND6_LLINFO_REACHABLE;
ln->ln_byhint = 0;
@@ -712,11 +715,11 @@
else {
if (sdl->sdl_alen) {
if (memcmp(lladdr, CLLADDR(sdl), ifp->if_addrlen))
- llchange = 1;
+ llchange = rt_announce = 1;
else
llchange = 0;
} else
- llchange = 1;
+ llchange = rt_announce = 1;
}
/*
@@ -819,6 +822,8 @@
rt->rt_flags &= ~RTF_REJECT;
ln->ln_asked = 0;
nd6_llinfo_release_pkts(ln, ifp, rt);
+ if (rt_announce) /* tell user process about any new lladdr */
+ nd6_rtmsg(RTM_CHANGE, rt);
freeit:
m_freem(m);
diff -r 43a2a0640ef1 -r 889cd03b8364 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c Tue Dec 16 11:34:17 2014 +0000
+++ b/sys/netinet6/nd6_rtr.c Tue Dec 16 11:42:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.94 2014/09/05 06:08:15 matt Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.95 2014/12/16 11:42:27 roy 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.94 2014/09/05 06:08:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.95 2014/12/16 11:42:27 roy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,7 +76,6 @@
static struct nd_pfxrouter *find_pfxlist_reachable_router
(struct nd_prefix *);
static void defrouter_delreq(struct nd_defrouter *);
-static void nd6_rtmsg(int, struct rtentry *);
static int in6_init_prefix_ltimes(struct nd_prefix *);
static void in6_init_address_ltimes(struct nd_prefix *,
@@ -416,7 +415,7 @@
*/
/* tell the change to user processes watching the routing socket. */
-static void
+void
nd6_rtmsg(int cmd, struct rtentry *rt)
{
struct rt_addrinfo info;
Home |
Main Index |
Thread Index |
Old Index