Source-Changes-HG archive

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

[src/trunk]: src/sys rtsock: rework rt_clonedmsg to take a message type and l...



details:   https://anonhg.NetBSD.org/src/rev/1f45eea9f333
branches:  trunk
changeset: 453682:1f45eea9f333
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Aug 22 21:14:45 2019 +0000

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

diffstat:

 sys/net/route.h      |   6 +++---
 sys/net/rtsock.c     |  19 +++++++++----------
 sys/netinet/if_arp.c |   7 ++++---
 sys/netinet6/nd6.c   |   7 ++++---
 4 files changed, 20 insertions(+), 19 deletions(-)

diffs (133 lines):

diff -r 8de49dce0670 -r 1f45eea9f333 sys/net/route.h
--- a/sys/net/route.h   Thu Aug 22 20:28:08 2019 +0000
+++ b/sys/net/route.h   Thu Aug 22 21:14:45 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.124 2019/08/22 21:14:45 roy 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 8de49dce0670 -r 1f45eea9f333 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Thu Aug 22 20:28:08 2019 +0000
+++ b/sys/net/rtsock.c  Thu Aug 22 21:14:45 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.251 2019/08/22 21:14:45 roy 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.251 2019/08/22 21:14:45 roy 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 8de49dce0670 -r 1f45eea9f333 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Thu Aug 22 20:28:08 2019 +0000
+++ b/sys/netinet/if_arp.c      Thu Aug 22 21:14:45 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.283 2019/08/19 03:23:30 ozaki-r Exp $     */
+/*     $NetBSD: if_arp.c,v 1.284 2019/08/22 21:14:46 roy 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.283 2019/08/19 03:23:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.284 2019/08/22 21:14:46 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -751,7 +751,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 8de49dce0670 -r 1f45eea9f333 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Thu Aug 22 20:28:08 2019 +0000
+++ b/sys/netinet6/nd6.c        Thu Aug 22 21:14:45 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.257 2019/08/14 08:34:44 ozaki-r Exp $        */
+/*     $NetBSD: nd6.c,v 1.258 2019/08/22 21:14:46 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.257 2019/08/14 08:34:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.258 2019/08/22 21:14:46 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2357,7 +2357,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;
        }



Home | Main Index | Thread Index | Old Index