summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-10-25 11:58:11 +0000
committermpi <mpi@openbsd.org>2015-10-25 11:58:11 +0000
commitdcb17c31bf7404748e80f11c1acaec2123371507 (patch)
treec478650cab74ff7f4d1a794f3afd8fdf9597587a /sys
parentbackout; many issues remain... (diff)
downloadwireguard-openbsd-dcb17c31bf7404748e80f11c1acaec2123371507.tar.xz
wireguard-openbsd-dcb17c31bf7404748e80f11c1acaec2123371507.zip
Introduce if_rtrequest() the successor of ifa_rtrequest().
L2 resolution depends on the protocol (encoded in the route entry) and an ``ifp''. Not having to care about an ``ifa'' makes our life easier in our MP effort. Fewer dependencies between data structures implies fewer headaches. Discussed with bluhm@, ok claudio@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c11
-rw-r--r--sys/net/if_ethersubr.c20
-rw-r--r--sys/net/if_gif.c5
-rw-r--r--sys/net/if_gre.c5
-rw-r--r--sys/net/if_loop.c10
-rw-r--r--sys/net/if_ppp.c4
-rw-r--r--sys/net/if_pppoe.c3
-rw-r--r--sys/net/if_pppx.c5
-rw-r--r--sys/net/if_spppsubr.c4
-rw-r--r--sys/net/if_tun.c5
-rw-r--r--sys/net/if_var.h12
-rw-r--r--sys/net/route.c18
-rw-r--r--sys/net/rtsock.c10
-rw-r--r--sys/netinet/if_ether.c6
-rw-r--r--sys/netinet/if_ether.h4
-rw-r--r--sys/netinet/ip_carp.c3
-rw-r--r--sys/netinet6/in6.c10
-rw-r--r--sys/netinet6/nd6.c7
-rw-r--r--sys/netinet6/nd6.h4
-rw-r--r--sys/netinet6/nd6_rtr.c6
20 files changed, 74 insertions, 78 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 2e24c4f5296..019b6d7d419 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.394 2015/10/24 10:52:05 reyk Exp $ */
+/* $OpenBSD: if.c,v 1.395 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -520,6 +520,7 @@ if_attach_common(struct ifnet *ifp)
M_TEMP, M_WAITOK);
TAILQ_INIT(ifp->if_detachhooks);
+ ifp->if_rtrequest = if_rtrequest_dummy;
ifp->if_slowtimo = malloc(sizeof(*ifp->if_slowtimo), M_TEMP,
M_WAITOK|M_ZERO);
ifp->if_watchdogtask = malloc(sizeof(*ifp->if_watchdogtask),
@@ -1273,14 +1274,18 @@ ifaof_ifpforaddr(struct sockaddr *addr, struct ifnet *ifp)
return (ifa_maybe);
}
+void
+if_rtrequest_dummy(struct ifnet *ifp, int req, struct rtentry *rt)
+{
+}
+
/*
* Default action when installing a local route on a point-to-point
* interface.
*/
void
-p2p_rtrequest(int req, struct rtentry *rt)
+p2p_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
{
- struct ifnet *ifp = rt->rt_ifp;
struct ifaddr *ifa, *lo0ifa;
switch (req) {
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 0274d0009a1..9b4e7ada1f5 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.229 2015/10/22 15:37:47 bluhm Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.230 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -161,6 +161,23 @@ ether_ioctl(struct ifnet *ifp, struct arpcom *arp, u_long cmd, caddr_t data)
return (error);
}
+
+void
+ether_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
+{
+ switch (rt_key(rt)->sa_family) {
+ case AF_INET:
+ arp_rtrequest(ifp, req, rt);
+ break;
+#ifdef INET6
+ case AF_INET6:
+ nd6_rtrequest(ifp, req, rt);
+ break;
+#endif
+ default:
+ break;
+ }
+}
/*
* Ethernet output routine.
* Encapsulate a packet of type family for the local net.
@@ -505,6 +522,7 @@ ether_ifattach(struct ifnet *ifp)
ifp->if_hdrlen = ETHER_HDR_LEN;
ifp->if_mtu = ETHERMTU;
ifp->if_output = ether_output;
+ ifp->if_rtrequest = ether_rtrequest;
if_ih_insert(ifp, ether_input, NULL);
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 65c8d08d123..92398947e40 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gif.c,v 1.80 2015/09/28 08:32:05 mpi Exp $ */
+/* $OpenBSD: if_gif.c,v 1.81 2015/10/25 11:58:11 mpi Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/*
@@ -120,6 +120,7 @@ gif_clone_create(struct if_clone *ifc, int unit)
sc->gif_if.if_ioctl = gif_ioctl;
sc->gif_if.if_start = gif_start;
sc->gif_if.if_output = gif_output;
+ sc->gif_if.if_rtrequest = p2p_rtrequest;
sc->gif_if.if_type = IFT_GIF;
IFQ_SET_MAXLEN(&sc->gif_if.if_snd, IFQ_MAXLEN);
IFQ_SET_READY(&sc->gif_if.if_snd);
@@ -326,7 +327,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct gif_softc *sc = (struct gif_softc*)ifp;
struct ifreq *ifr = (struct ifreq *)data;
- struct ifaddr *ifa = (struct ifaddr *)data;
int error = 0, size;
struct sockaddr *dst, *src;
struct sockaddr *sa;
@@ -335,7 +335,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
switch (cmd) {
case SIOCSIFADDR:
- ifa->ifa_rtrequest = p2p_rtrequest;
break;
case SIOCSIFDSTADDR:
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 93035a15124..767e8fb886b 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.75 2015/07/16 16:12:15 mpi Exp $ */
+/* $OpenBSD: if_gre.c,v 1.76 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -132,6 +132,7 @@ gre_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
sc->sc_if.if_output = gre_output;
sc->sc_if.if_ioctl = gre_ioctl;
+ sc->sc_if.if_rtrequest = p2p_rtrequest;
sc->sc_if.if_collisions = 0;
sc->sc_if.if_ierrors = 0;
sc->sc_if.if_oerrors = 0;
@@ -436,7 +437,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct ifreq *ifr = (struct ifreq *)data;
- struct ifaddr *ifa = (struct ifaddr *)data;
struct if_laddrreq *lifr = (struct if_laddrreq *)data;
struct ifkalivereq *ikar = (struct ifkalivereq *)data;
struct gre_softc *sc = ifp->if_softc;
@@ -450,7 +450,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
switch(cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
- ifa->ifa_rtrequest = p2p_rtrequest;
break;
case SIOCSIFDSTADDR:
break;
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 8caaf6a255a..be1e31f62e8 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_loop.c,v 1.71 2015/09/12 13:34:12 mpi Exp $ */
+/* $OpenBSD: if_loop.c,v 1.72 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
@@ -168,6 +168,7 @@ loop_clone_create(struct if_clone *ifc, int unit)
ifp->if_softc = NULL;
ifp->if_mtu = LOMTU;
ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
+ ifp->if_rtrequest = lortrequest;
ifp->if_ioctl = loioctl;
ifp->if_output = looutput;
ifp->if_type = IFT_LOOP;
@@ -217,7 +218,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
/* ARGSUSED */
void
-lortrequest(int cmd, struct rtentry *rt)
+lortrequest(struct ifnet *ifp, int cmd, struct rtentry *rt)
{
if (rt && rt->rt_rmx.rmx_mtu == 0)
rt->rt_rmx.rmx_mtu = LOMTU;
@@ -230,7 +231,6 @@ lortrequest(int cmd, struct rtentry *rt)
int
loioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
- struct ifaddr *ifa;
struct ifreq *ifr;
int error = 0;
@@ -239,10 +239,6 @@ loioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFADDR:
ifp->if_flags |= IFF_RUNNING;
if_up(ifp); /* send up RTM_IFINFO */
-
- ifa = (struct ifaddr *)data;
- if (ifa != 0)
- ifa->ifa_rtrequest = lortrequest;
/*
* Everything else is done at a higher level.
*/
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index 4c85df2ab51..3d4827bba20 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ppp.c,v 1.90 2015/10/12 13:17:58 dlg Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.91 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
@@ -223,6 +223,7 @@ ppp_clone_create(struct if_clone *ifc, int unit)
sc->sc_if.if_ioctl = pppsioctl;
sc->sc_if.if_output = pppoutput;
sc->sc_if.if_start = ppp_ifstart;
+ sc->sc_if.if_rtrequest = p2p_rtrequest;
IFQ_SET_MAXLEN(&sc->sc_if.if_snd, IFQ_MAXLEN);
mq_init(&sc->sc_inq, IFQ_MAXLEN, IPL_NET);
IFQ_SET_MAXLEN(&sc->sc_fastq, IFQ_MAXLEN);
@@ -593,7 +594,6 @@ pppsioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCSIFADDR:
if (ifa->ifa_addr->sa_family != AF_INET)
error = EAFNOSUPPORT;
- ifa->ifa_rtrequest = p2p_rtrequest;
break;
case SIOCSIFDSTADDR:
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 33aab112b62..da2c09cc23c 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.48 2015/09/13 17:53:44 mpi Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.49 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -228,6 +228,7 @@ pppoe_clone_create(struct if_clone *ifc, int unit)
sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN; /* framing added to ppp packets */
sc->sc_sppp.pp_if.if_ioctl = pppoe_ioctl;
sc->sc_sppp.pp_if.if_start = pppoe_start;
+ sc->sc_sppp.pp_if.if_rtrequest = p2p_rtrequest;
sc->sc_sppp.pp_tls = pppoe_tls;
sc->sc_sppp.pp_tlf = pppoe_tlf;
IFQ_SET_MAXLEN(&sc->sc_sppp.pp_if.if_snd, IFQ_MAXLEN);
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c
index d88e92f5008..c6a9d980191 100644
--- a/sys/net/if_pppx.c
+++ b/sys/net/if_pppx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppx.c,v 1.43 2015/09/06 12:59:20 kettenis Exp $ */
+/* $OpenBSD: if_pppx.c,v 1.44 2015/10/25 11:58:11 mpi Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
@@ -832,6 +832,7 @@ pppx_add_session(struct pppx_dev *pxd, struct pipex_session_req *req)
ifp->if_start = pppx_if_start;
ifp->if_output = pppx_if_output;
ifp->if_ioctl = pppx_if_ioctl;
+ ifp->if_rtrequest = p2p_rtrequest;
ifp->if_type = IFT_PPP;
IFQ_SET_MAXLEN(&ifp->if_snd, 1);
IFQ_SET_READY(&ifp->if_snd);
@@ -1069,12 +1070,10 @@ pppx_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
{
struct pppx_if *pxi = (struct pppx_if *)ifp->if_softc;
struct ifreq *ifr = (struct ifreq *)addr;
- struct ifaddr *ifa = (struct ifaddr *)addr;
int error = 0;
switch (cmd) {
case SIOCSIFADDR:
- ifa->ifa_rtrequest = p2p_rtrequest;
break;
case SIOCSIFFLAGS:
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index afaa7e9ed9f..f444339adf7 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.142 2015/10/24 11:58:46 mpi Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.143 2015/10/25 11:58:11 mpi Exp $ */
/*
* Synchronous PPP link level subroutines.
*
@@ -871,7 +871,6 @@ int
sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct ifreq *ifr = data;
- struct ifaddr *ifa = data;
struct sppp *sp = (struct sppp*) ifp;
int s, rv, going_up, going_down, newmode;
@@ -884,7 +883,6 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data)
case SIOCSIFADDR:
if_up(ifp);
- ifa->ifa_rtrequest = p2p_rtrequest;
/* FALLTHROUGH */
case SIOCSIFFLAGS:
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index d52dc4bb2b0..84041b75d64 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.157 2015/10/24 04:12:24 dlg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.158 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -219,6 +219,7 @@ tun_create(struct if_clone *ifc, int unit, int flags)
ifp->if_flags = IFF_POINTOPOINT;
ifp->if_type = IFT_TUNNEL;
ifp->if_hdrlen = sizeof(u_int32_t);
+ ifp->if_rtrequest = p2p_rtrequest;
if_attach(ifp);
if_alloc_sadl(ifp);
@@ -506,8 +507,6 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
default:
break;
}
- } else {
- ifa->ifa_rtrequest = p2p_rtrequest;
}
break;
case SIOCSIFDSTADDR:
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index af1c8a5b7d7..4c169c18dba 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.50 2015/10/24 10:52:05 reyk Exp $ */
+/* $OpenBSD: if_var.h,v 1.51 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -129,6 +129,8 @@ struct ifnet { /* and the entries */
struct hook_desc_head *if_addrhooks; /* address change callbacks */
struct hook_desc_head *if_linkstatehooks; /* link change callbacks */
struct hook_desc_head *if_detachhooks; /* detach callbacks */
+ /* check or clean routes (+ or -)'d */
+ void (*if_rtrequest)(struct ifnet *, int, struct rtentry *);
char if_xname[IFNAMSIZ]; /* external name (name + unit) */
int if_pcount; /* number of promiscuous listeners */
caddr_t if_bpf; /* packet filter structure */
@@ -213,8 +215,6 @@ struct ifaddr {
struct sockaddr *ifa_netmask; /* used to determine subnet */
struct ifnet *ifa_ifp; /* back-pointer to interface */
TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */
- /* check or clean routes (+ or -)'d */
- void (*ifa_rtrequest)(int, struct rtentry *);
u_int ifa_flags; /* interface flags, see below */
u_int ifa_refcnt; /* number of `rt_ifa` references */
int ifa_metric; /* cost of going out this interface */
@@ -408,6 +408,8 @@ void if_start(struct ifnet *);
int if_enqueue(struct ifnet *, struct mbuf *);
void if_input(struct ifnet *, struct mbuf_list *);
int if_input_local(struct ifnet *, struct mbuf *, sa_family_t);
+void if_rtrequest_dummy(struct ifnet *, int, struct rtentry *);
+void p2p_rtrequest(struct ifnet *, int, struct rtentry *);
void ether_ifattach(struct ifnet *);
void ether_ifdetach(struct ifnet *);
@@ -415,6 +417,7 @@ int ether_ioctl(struct ifnet *, struct arpcom *, u_long, caddr_t);
int ether_input(struct ifnet *, struct mbuf *, void *);
int ether_output(struct ifnet *,
struct mbuf *, struct sockaddr *, struct rtentry *);
+void ether_rtrequest(struct ifnet *, int, struct rtentry *);
char *ether_sprintf(u_char *);
struct ifaddr *ifa_ifwithaddr(struct sockaddr *, u_int);
@@ -422,7 +425,6 @@ struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *, u_int);
struct ifaddr *ifa_ifwithnet(struct sockaddr *, u_int);
struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
void ifafree(struct ifaddr *);
-void p2p_rtrequest(int, struct rtentry *);
void if_clone_attach(struct if_clone *);
void if_clone_detach(struct if_clone *);
@@ -440,7 +442,7 @@ int loioctl(struct ifnet *, u_long, caddr_t);
void loopattach(int);
int looutput(struct ifnet *,
struct mbuf *, struct sockaddr *, struct rtentry *);
-void lortrequest(int, struct rtentry *);
+void lortrequest(struct ifnet *, int, struct rtentry *);
void ifa_add(struct ifnet *, struct ifaddr *);
void ifa_del(struct ifnet *, struct ifaddr *);
diff --git a/sys/net/route.c b/sys/net/route.c
index 804a33b4071..740cf242852 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.261 2015/10/25 10:05:09 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.262 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -782,8 +782,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
rt->rt_parent = NULL;
rt->rt_flags &= ~RTF_UP;
- if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
- ifa->ifa_rtrequest(RTM_DELETE, rt);
+ rt->rt_ifp->if_rtrequest(rt->rt_ifp, RTM_DELETE, rt);
atomic_inc_int(&rttrash);
if (ret_nrt != NULL)
@@ -922,15 +921,14 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
if ((*ret_nrt)->rt_ifa->ifa_ifp == NULL) {
printf("rtrequest1 RTM_RESOLVE: wrong ifa (%p) "
"was (%p)\n", ifa, (*ret_nrt)->rt_ifa);
- if ((*ret_nrt)->rt_ifa->ifa_rtrequest)
- (*ret_nrt)->rt_ifa->ifa_rtrequest(
- RTM_DELETE, *ret_nrt);
+ (*ret_nrt)->rt_ifp->if_rtrequest(rt->rt_ifp,
+ RTM_DELETE, *ret_nrt);
ifafree((*ret_nrt)->rt_ifa);
(*ret_nrt)->rt_ifa = ifa;
(*ret_nrt)->rt_ifp = ifa->ifa_ifp;
ifa->ifa_refcnt++;
- if (ifa->ifa_rtrequest)
- ifa->ifa_rtrequest(RTM_ADD, *ret_nrt);
+ (*ret_nrt)->rt_ifp->if_rtrequest(rt->rt_ifp,
+ RTM_ADD, *ret_nrt);
}
/*
* Copy both metrics and a back pointer to the cloned
@@ -978,9 +976,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
pool_put(&rtentry_pool, rt);
return (EEXIST);
}
-
- if (ifa->ifa_rtrequest)
- ifa->ifa_rtrequest(req, rt);
+ rt->rt_ifp->if_rtrequest(rt->rt_ifp, req, rt);
if ((rt->rt_flags & RTF_CLONING) != 0) {
/* clean up any cloned children */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 79a09d8d152..f618995cebb 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.177 2015/10/25 10:05:09 bluhm Exp $ */
+/* $OpenBSD: rtsock.c,v 1.178 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -766,9 +766,8 @@ report:
goto flush;
if (ifa) {
if (rt->rt_ifa != ifa) {
- if (rt->rt_ifa->ifa_rtrequest)
- rt->rt_ifa->ifa_rtrequest(
- RTM_DELETE, rt);
+ rt->rt_ifp->if_rtrequest(
+ rt->rt_ifp, RTM_DELETE, rt);
ifafree(rt->rt_ifa);
rt->rt_ifa = ifa;
ifa->ifa_refcnt++;
@@ -832,8 +831,7 @@ report:
rtm->rtm_index = rt->rt_ifidx;
rtm->rtm_priority = rt->rt_priority & RTP_MASK;
rtm->rtm_flags = rt->rt_flags;
- if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
- rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt);
+ rt->rt_ifp->if_rtrequest(rt->rt_ifp, RTM_ADD, rt);
if (info.rti_info[RTAX_LABEL] != NULL) {
char *rtlabel = ((struct sockaddr_rtlabel *)
info.rti_info[RTAX_LABEL])->sr_label;
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 7e5e32e470e..a5967cf2463 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.176 2015/10/22 18:14:53 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.177 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -137,11 +137,10 @@ arptimer(void *arg)
}
void
-arp_rtrequest(int req, struct rtentry *rt)
+arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
{
struct sockaddr *gate = rt->rt_gateway;
struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
- struct ifnet *ifp = rt->rt_ifp;
struct ifaddr *ifa;
struct mbuf *m;
@@ -821,7 +820,6 @@ arpproxy(struct in_addr in, unsigned int rtableid)
void
arp_ifinit(struct arpcom *ac, struct ifaddr *ifa)
{
- ifa->ifa_rtrequest = arp_rtrequest;
}
/*
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 9037a8f4085..b3aa1c0c8b9 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.60 2015/09/27 16:50:40 stsp Exp $ */
+/* $OpenBSD: if_ether.h,v 1.61 2015/10/25 11:58:11 mpi Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -197,7 +197,7 @@ void arpintr(void);
int arpresolve(struct ifnet *,
struct rtentry *, struct mbuf *, struct sockaddr *, u_char *);
void arp_ifinit(struct arpcom *, struct ifaddr *);
-void arp_rtrequest(int, struct rtentry *);
+void arp_rtrequest(struct ifnet *, int, struct rtentry *);
int ether_addmulti(struct ifreq *, struct arpcom *);
int ether_delmulti(struct ifreq *, struct arpcom *);
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 8dd1a3520a1..001be8ffc8a 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.277 2015/10/22 13:30:29 mpi Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.278 2015/10/25 11:58:11 mpi Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -2097,7 +2097,6 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
switch (ifa->ifa_addr->sa_family) {
case AF_INET:
sc->sc_if.if_flags |= IFF_UP;
- ifa->ifa_rtrequest = arp_rtrequest;
error = carp_set_addr(sc, satosin(ifa->ifa_addr));
break;
#ifdef INET6
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 08d150409a4..65cc151cbc4 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.175 2015/09/12 20:50:17 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.176 2015/10/25 11:58:11 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -1261,14 +1261,8 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia6, int newhost)
ia6->ia_flags |= IFA_ROUTE;
}
- /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
- if (newhost) {
- /* set the rtrequest function to create llinfo */
- if ((ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) == 0)
- ia6->ia_ifa.ifa_rtrequest = nd6_rtrequest;
-
+ if (newhost)
rt_ifa_addlocal(&(ia6->ia_ifa));
- }
return (error);
}
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 1d30d63a979..f1692dc6dab 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.159 2015/10/24 16:08:48 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.160 2015/10/25 11:58:11 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -661,7 +661,7 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp,
* Create a new route. RTF_LLINFO is necessary
* to create a Neighbor Cache entry for the
* destination in nd6_rtrequest which will be
- * called in rtrequest1 via ifa->ifa_rtrequest.
+ * called in rtrequest1.
*/
bzero(&info, sizeof(info));
info.rti_flags = RTF_HOST | RTF_LLINFO;
@@ -917,11 +917,10 @@ nd6_nud_hint(struct rtentry *rt, u_int rtableid)
}
void
-nd6_rtrequest(int req, struct rtentry *rt)
+nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
{
struct sockaddr *gate = rt->rt_gateway;
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
- struct ifnet *ifp = rt->rt_ifp;
struct ifaddr *ifa;
struct nd_defrouter *dr;
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 162dec320a9..03ad2db22af 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.h,v 1.50 2015/10/24 16:08:48 mpi Exp $ */
+/* $OpenBSD: nd6.h,v 1.51 2015/10/25 11:58:11 mpi Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@@ -272,7 +272,7 @@ void nd6_purge(struct ifnet *);
void nd6_nud_hint(struct rtentry *, u_int);
int nd6_resolve(struct ifnet *, struct rtentry *,
struct mbuf *, struct sockaddr *, u_char *);
-void nd6_rtrequest(int, struct rtentry *);
+void nd6_rtrequest(struct ifnet *, int, struct rtentry *);
int nd6_ioctl(u_long, caddr_t, struct ifnet *);
void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int);
int nd6_output(struct ifnet *, struct mbuf *, struct sockaddr_in6 *,
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 025372d55a6..b160a283903 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.127 2015/10/24 16:08:48 mpi Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.128 2015/10/25 11:58:11 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -1789,10 +1789,6 @@ nd6_prefix_onlink(struct nd_prefix *pr)
return (0);
}
- /*
- * in6_ifinit() sets nd6_rtrequest to ifa_rtrequest for all ifaddrs.
- * ifa->ifa_rtrequest = nd6_rtrequest;
- */
bzero(&mask6, sizeof(mask6));
mask6.sin6_len = sizeof(mask6);
mask6.sin6_addr = pr->ndpr_mask;