Module Name: src Committed By: roy Date: Thu Aug 22 21:14:46 UTC 2019
Modified Files: src/sys/net: route.h rtsock.c src/sys/netinet: if_arp.c src/sys/netinet6: nd6.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/net/route.h cvs rdiff -u -r1.250 -r1.251 src/sys/net/rtsock.c cvs rdiff -u -r1.283 -r1.284 src/sys/netinet/if_arp.c cvs rdiff -u -r1.257 -r1.258 src/sys/netinet6/nd6.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/net/route.h diff -u src/sys/net/route.h:1.123 src/sys/net/route.h:1.124 --- src/sys/net/route.h:1.123 Mon Apr 29 16:12:30 2019 +++ src/sys/net/route.h Thu Aug 22 21:14:45 2019 @@ -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 rt_addrmsg_rt(int, struct ifaddr *, 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 *); Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.250 src/sys/net/rtsock.c:1.251 --- src/sys/net/rtsock.c:1.250 Mon May 27 05:33:48 2019 +++ src/sys/net/rtsock.c Thu Aug 22 21:14:45 2019 @@ -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 @@ if_addrflags(struct ifaddr *ifa) * 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 @@ rt_clonedmsg(const struct sockaddr *dst, 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 } Index: src/sys/netinet/if_arp.c diff -u src/sys/netinet/if_arp.c:1.283 src/sys/netinet/if_arp.c:1.284 --- src/sys/netinet/if_arp.c:1.283 Mon Aug 19 03:23:30 2019 +++ src/sys/netinet/if_arp.c Thu Aug 22 21:14:46 2019 @@ -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 @@ notfound: 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"; Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.257 src/sys/netinet6/nd6.c:1.258 --- src/sys/netinet6/nd6.c:1.257 Wed Aug 14 08:34:44 2019 +++ src/sys/netinet6/nd6.c Thu Aug 22 21:14:46 2019 @@ -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 @@ nd6_resolve(struct ifnet *ifp, const str } 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; }