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
This commit is contained in:
parent
ca50e52c93
commit
508a301f81
|
@ -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 *, int, struct rtentry *);
|
|||
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 *);
|
||||
|
||||
|
|
|
@ -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, const struct ifnet *ifp,
|
|||
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
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 struct rtentry *rt, struct mbuf *m,
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue