Module Name: src
Committed By: martin
Date: Wed Dec 17 18:43:48 UTC 2014
Modified Files:
src/sys/netinet6 [netbsd-7]: nd6.c nd6.h nd6_nbr.c nd6_rtr.c
Log Message:
Pull up following revision(s) (requested by roy in ticket #332):
sys/netinet6/nd6_nbr.c: revision 1.103
sys/netinet6/nd6_rtr.c: revision 1.95
sys/netinet6/nd6.h: revision 1.61
sys/netinet6/nd6.c: revision 1.156
Report route additions/changes/deletions for cached neighbours to userland.
To generate a diff of this commit:
cvs rdiff -u -r1.152.2.1 -r1.152.2.2 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.59 -r1.59.2.1 src/sys/netinet6/nd6.h
cvs rdiff -u -r1.100 -r1.100.2.1 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.93 -r1.93.2.1 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.152.2.1 src/sys/netinet6/nd6.c:1.152.2.2
--- src/sys/netinet6/nd6.c:1.152.2.1 Mon Oct 27 13:39:11 2014
+++ src/sys/netinet6/nd6.c Wed Dec 17 18:43:47 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.152.2.1 2014/10/27 13:39:11 martin Exp $ */
+/* $NetBSD: nd6.c,v 1.152.2.2 2014/12/17 18:43:47 martin 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.152.2.1 2014/10/27 13:39:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.152.2.2 2014/12/17 18:43:47 martin 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
Index: src/sys/netinet6/nd6.h
diff -u src/sys/netinet6/nd6.h:1.59 src/sys/netinet6/nd6.h:1.59.2.1
--- src/sys/netinet6/nd6.h:1.59 Thu Jun 5 16:06:49 2014
+++ src/sys/netinet6/nd6.h Wed Dec 17 18:43:47 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.h,v 1.59 2014/06/05 16:06:49 roy Exp $ */
+/* $NetBSD: nd6.h,v 1.59.2.1 2014/12/17 18:43:47 martin Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -408,6 +408,7 @@ void nd6_option_init(void *, int, union
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 *);
Index: src/sys/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.100 src/sys/netinet6/nd6_nbr.c:1.100.2.1
--- src/sys/netinet6/nd6_nbr.c:1.100 Tue Jul 1 07:51:29 2014
+++ src/sys/netinet6/nd6_nbr.c Wed Dec 17 18:43:47 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_nbr.c,v 1.100 2014/07/01 07:51:29 ozaki-r Exp $ */
+/* $NetBSD: nd6_nbr.c,v 1.100.2.1 2014/12/17 18:43:47 martin 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.100 2014/07/01 07:51:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.100.2.1 2014/12/17 18:43:47 martin Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -567,6 +567,7 @@ nd6_na_input(struct mbuf *m, int off, in
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 @@ nd6_na_input(struct mbuf *m, int off, in
((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 @@ nd6_na_input(struct mbuf *m, int off, in
*/
(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 @@ nd6_na_input(struct mbuf *m, int off, in
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 @@ nd6_na_input(struct mbuf *m, int off, in
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);
Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.93 src/sys/netinet6/nd6_rtr.c:1.93.2.1
--- src/sys/netinet6/nd6_rtr.c:1.93 Thu Jul 31 06:35:47 2014
+++ src/sys/netinet6/nd6_rtr.c Wed Dec 17 18:43:47 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.93 2014/07/31 06:35:47 ozaki-r Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.93.2.1 2014/12/17 18:43:47 martin 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.93 2014/07/31 06:35:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.93.2.1 2014/12/17 18:43:47 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -76,7 +76,6 @@ static void pfxrtr_del(struct nd_pfxrout
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 @@ nd6_ra_input(struct mbuf *m, int off, in
*/
/* tell the change to user processes watching the routing socket. */
-static void
+void
nd6_rtmsg(int cmd, struct rtentry *rt)
{
struct rt_addrinfo info;