Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by roy in ti...



details:   https://anonhg.NetBSD.org/src/rev/3bc1a0c09c06
branches:  netbsd-9
changeset: 453811:3bc1a0c09c06
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Aug 26 13:42:36 2019 +0000

description:
Pull up following revision(s) (requested by roy in ticket #109):

        sys/net/route.h: revision 1.124
        sys/netinet6/nd6.c: revision 1.258
        sys/netinet6/nd6.c: revision 1.259
        sys/net/rtsock.c: revision 1.251
        sys/netinet/if_arp.c: revision 1.284
        sys/netinet6/nd6_nbr.c: revision 1.167

rtsock: rework rt_clonedmsg to take a message type and lladdr

We will use this in a future patch to notify userland of lladdr
changes.

XXX pullup -8 -9

 -

nd6: notify userland of neighbour lla updates once more

XXX pullup -8 -9

diffstat:

 sys/net/route.h        |   6 +++---
 sys/net/rtsock.c       |  19 +++++++++----------
 sys/netinet/if_arp.c   |   7 ++++---
 sys/netinet6/nd6.c     |  24 ++++++++++++++++--------
 sys/netinet6/nd6_nbr.c |  16 +++++++++-------
 5 files changed, 41 insertions(+), 31 deletions(-)

diffs (208 lines):

diff -r e00a3d885126 -r 3bc1a0c09c06 sys/net/route.h
--- a/sys/net/route.h   Mon Aug 26 13:37:26 2019 +0000
+++ b/sys/net/route.h   Mon Aug 26 13:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.123 2019/04/29 16:12:30 roy Exp $  */
+/*     $NetBSD: route.h,v 1.123.2.1 2019/08/26 13:42:36 martin Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -521,8 +521,8 @@
 void   route_enqueue(struct mbuf *, int);
 
 struct llentry;
-void   rt_clonedmsg(const struct sockaddr *, const struct ifnet *,
-           const struct rtentry *);
+void   rt_clonedmsg(int, const struct sockaddr *, const uint8_t *,
+            const struct ifnet *);
 
 void   rt_setmetrics(void *, struct rtentry *);
 
diff -r e00a3d885126 -r 3bc1a0c09c06 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Mon Aug 26 13:37:26 2019 +0000
+++ b/sys/net/rtsock.c  Mon Aug 26 13:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.250 2019/05/27 05:33:48 ozaki-r Exp $     */
+/*     $NetBSD: rtsock.c,v 1.250.2.1 2019/08/26 13:42:36 martin Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.250 2019/05/27 05:33:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.250.2.1 2019/08/26 13:42:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -145,14 +145,14 @@
  * Send a routing message as mimicing that a cloned route is added.
  */
 void
-rt_clonedmsg(const struct sockaddr *dst, const struct ifnet *ifp,
-    const struct rtentry *rt)
+rt_clonedmsg(int type, const struct sockaddr *dst, const uint8_t *lladdr,
+    const struct ifnet *ifp)
 {
        struct rt_addrinfo info;
        /* Mimic flags exactly */
 #define RTF_LLINFO     0x400
 #define RTF_CLONED     0x2000
-       int flags = RTF_UP | RTF_HOST | RTF_DONE | RTF_LLINFO | RTF_CLONED;
+       int flags = RTF_HOST | RTF_DONE | RTF_LLINFO | RTF_CLONED;
        union {
                struct sockaddr sa;
                struct sockaddr_storage ss;
@@ -161,16 +161,15 @@
        uint8_t namelen = strlen(ifp->if_xname);
        uint8_t addrlen = ifp->if_addrlen;
 
-       if (rt == NULL)
-               return; /* XXX */
-
+       if (type != RTM_DELETE)
+               flags |= RTF_UP;
        memset(&info, 0, sizeof(info));
        info.rti_info[RTAX_DST] = dst;
        sockaddr_dl_init(&u.sdl, sizeof(u.ss), ifp->if_index, ifp->if_type,
-           NULL, namelen, NULL, addrlen);
+           NULL, namelen, lladdr, addrlen);
        info.rti_info[RTAX_GATEWAY] = &u.sa;
 
-       rt_missmsg(RTM_ADD, &info, flags, 0);
+       rt_missmsg(type, &info, flags, 0);
 #undef RTF_LLINFO
 #undef RTF_CLONED
 }
diff -r e00a3d885126 -r 3bc1a0c09c06 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Mon Aug 26 13:37:26 2019 +0000
+++ b/sys/netinet/if_arp.c      Mon Aug 26 13:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.282 2019/04/29 16:12:30 roy Exp $ */
+/*     $NetBSD: if_arp.c,v 1.282.2.1 2019/08/26 13:42:36 martin Exp $  */
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.282 2019/04/29 16:12:30 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.282.2.1 2019/08/26 13:42:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -744,7 +744,8 @@
 
                        arp_init_llentry(ifp, la);
                        sockaddr_in_init(&sin, &la->r_l3addr.addr4, 0);
-                       rt_clonedmsg(sintosa(&sin), ifp, rt);
+                       if (rt != NULL)
+                               rt_clonedmsg(RTM_ADD, sintosa(&sin), NULL, ifp);
                }
        } else if (LLE_TRY_UPGRADE(la) == 0) {
                create_lookup = "lookup";
diff -r e00a3d885126 -r 3bc1a0c09c06 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Mon Aug 26 13:37:26 2019 +0000
+++ b/sys/netinet6/nd6.c        Mon Aug 26 13:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.256.2.1 2019/08/19 16:08:19 martin Exp $     */
+/*     $NetBSD: nd6.c,v 1.256.2.2 2019/08/26 13:42:36 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.256.2.1 2019/08/19 16:08:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.256.2.2 2019/08/26 13:42:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1192,6 +1192,7 @@
        struct nd_defrouter *dr;
        struct ifnet *ifp;
        struct in6_addr *in6;
+       struct sockaddr_in6 sin6;
 
        KASSERT(ln != NULL);
        LLE_WLOCK_ASSERT(ln);
@@ -1293,6 +1294,10 @@
                        LLE_WLOCK(ln);
        }
 
+       sockaddr_in6_init(&sin6, in6, 0, 0, 0);
+       rt_clonedmsg(RTM_DELETE, sin6tosa(&sin6),
+           (const uint8_t *)&ln->ll_addr, ifp);
+
        /*
         * Save to unlock. We still hold an extra reference and will not
         * free(9) in llentry_free() if someone else holds one as well.
@@ -2225,11 +2230,13 @@
                break;
        }
 
-#if 0
-       /* XXX should we send rtmsg as it used to be? */
-       if (do_update)
-               rt_newmsg(RTM_CHANGE, rt);  /* tell user process */
-#endif
+       if (do_update) {
+               struct sockaddr_in6 sin6;
+
+               sockaddr_in6_init(&sin6, from, 0, 0, 0);
+               rt_clonedmsg(is_newentry ? RTM_ADD : RTM_CHANGE,
+                   sin6tosa(&sin6), lladdr, ifp);
+       }
 
        if (ln != NULL) {
                router = ln->ln_router;
@@ -2357,7 +2364,8 @@
                }
 
                sockaddr_in6_init(&sin6, &ln->r_l3addr.addr6, 0, 0, 0);
-               rt_clonedmsg(sin6tosa(&sin6), ifp, rt);
+               if (rt != NULL)
+                       rt_clonedmsg(RTM_ADD, sin6tosa(&sin6), NULL, ifp);
 
                created = true;
        }
diff -r e00a3d885126 -r 3bc1a0c09c06 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Mon Aug 26 13:37:26 2019 +0000
+++ b/sys/netinet6/nd6_nbr.c    Mon Aug 26 13:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.166 2019/04/29 16:12:30 roy Exp $        */
+/*     $NetBSD: nd6_nbr.c,v 1.166.2.1 2019/08/26 13:42:36 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.166 2019/04/29 16:12:30 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.166.2.1 2019/08/26 13:42:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -883,11 +883,13 @@
         */
        ln->ln_asked = 0;
        nd6_llinfo_release_pkts(ln, ifp);
-       /* FIXME */
-#if 0
-       if (rt_announce) /* tell user process about any new lladdr */
-               rt_newmsg(RTM_CHANGE, rt);
-#endif
+
+       if (rt_announce) {
+               struct sockaddr_in6 sin6;
+
+               sockaddr_in6_init(&sin6, &taddr6, 0, 0, 0);
+               rt_clonedmsg(RTM_CHANGE, sin6tosa(&sin6), lladdr, ifp);
+       }
 
  freeit:
        if (ln != NULL)



Home | Main Index | Thread Index | Old Index