Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/netinet6 Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/c457709927ea
branches:  netbsd-7
changeset: 798721:c457709927ea
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Dec 17 18:43:47 2014 +0000

description:
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.

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 90c67fb55701 -r c457709927ea sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Wed Dec 17 17:58:03 2014 +0000
+++ b/sys/netinet6/nd6.c        Wed Dec 17 18:43:47 2014 +0000
@@ -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 @@
        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 90c67fb55701 -r c457709927ea sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Wed Dec 17 17:58:03 2014 +0000
+++ b/sys/netinet6/nd6.h        Wed Dec 17 18:43:47 2014 +0000
@@ -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 @@
 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 90c67fb55701 -r c457709927ea sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Wed Dec 17 17:58:03 2014 +0000
+++ b/sys/netinet6/nd6_nbr.c    Wed Dec 17 18:43:47 2014 +0000
@@ -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 @@
        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 90c67fb55701 -r c457709927ea sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Wed Dec 17 17:58:03 2014 +0000
+++ b/sys/netinet6/nd6_rtr.c    Wed Dec 17 18:43:47 2014 +0000
@@ -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 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