summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-25 11:58:12 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-10-25 11:58:12 +0000
commitd7c02826bd0518fa3ad0c9ac4f00ba148683d42c (patch)
treefdfcead87b08eab5fe3ac46953117a34ba7dedb9 /sys/net
parent6fba9838094cca457e322bfa0e2e395449e078d9 (diff)
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/net')
-rw-r--r--sys/net/route.c18
-rw-r--r--sys/net/rtsock.c10
2 files changed, 11 insertions, 17 deletions
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;