summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-07-28 09:01:10 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-07-28 09:01:10 +0000
commitb97af349e824cbbd4816ec4716a60825891eafae (patch)
tree78a836cfb2f7983b461e10033958d6791c3b5527 /sys/net
parent2f27f1f1e864032ed15dc0fd9fe45906e7ab148d (diff)
Add an error argument to rtm_send() instead of rerolling it inside
rtdeletemsg(). ok bluhm@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/route.c16
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/net/rtsock.c6
3 files changed, 10 insertions, 16 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index cac8822a86d..f0b87a4272e 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.361 2017/07/27 12:27:24 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.362 2017/07/28 09:01:09 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -258,7 +258,7 @@ rt_match(struct sockaddr *dst, uint32_t *src, int flags, unsigned int tableid)
error, tableid);
} else {
/* Inform listeners of the new route */
- rtm_send(rt, RTM_ADD, tableid);
+ rtm_send(rt, RTM_ADD, 0, tableid);
rtfree(rt0);
}
KERNEL_UNLOCK();
@@ -627,7 +627,6 @@ rtdeletemsg(struct rtentry *rt, struct ifnet *ifp, u_int tableid)
{
int error;
struct rt_addrinfo info;
- struct sockaddr_rtlabel sa_rl;
struct sockaddr_in6 sa_mask;
KASSERT(rt->rt_ifidx == ifp->if_index);
@@ -642,14 +641,9 @@ rtdeletemsg(struct rtentry *rt, struct ifnet *ifp, u_int tableid)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
if (!ISSET(rt->rt_flags, RTF_HOST))
info.rti_info[RTAX_NETMASK] = rt_plen2mask(rt, &sa_mask);
- info.rti_info[RTAX_LABEL] = rtlabel_id2sa(rt->rt_labelid, &sa_rl);
- info.rti_flags = rt->rt_flags;
- info.rti_info[RTAX_IFP] = sdltosa(ifp->if_sadl);
- info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
error = rtrequest_delete(&info, rt->rt_priority, ifp, &rt, tableid);
KERNEL_LOCK();
- rtm_miss(RTM_DELETE, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx,
- error, tableid);
+ rtm_send(rt, RTM_DELETE, error, tableid);
KERNEL_UNLOCK();
if (error == 0)
rtfree(rt);
@@ -1072,7 +1066,7 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst)
*/
if (flags & RTF_LOCAL)
rtm_addr(rt, RTM_NEWADDR, ifa);
- rtm_send(rt, RTM_ADD, rtableid);
+ rtm_send(rt, RTM_ADD, 0, rtableid);
rtfree(rt);
}
return (error);
@@ -1125,7 +1119,7 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
error = rtrequest_delete(&info, prio, ifp, &rt, rtableid);
if (error == 0) {
- rtm_send(rt, RTM_DELETE, rtableid);
+ rtm_send(rt, RTM_DELETE, 0, rtableid);
if (flags & RTF_LOCAL)
rtm_addr(rt, RTM_DELADDR, ifa);
rtfree(rt);
diff --git a/sys/net/route.h b/sys/net/route.h
index c7236855315..fa51f97f41c 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.163 2017/07/24 09:20:32 mpi Exp $ */
+/* $OpenBSD: route.h,v 1.164 2017/07/28 09:01:09 mpi Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -423,7 +423,7 @@ void rtm_bfd(struct bfd_config *);
void rt_maskedcopy(struct sockaddr *,
struct sockaddr *, struct sockaddr *);
struct sockaddr *rt_plen2mask(struct rtentry *, struct sockaddr_in6 *);
-void rtm_send(struct rtentry *, int, u_int);
+void rtm_send(struct rtentry *, int, int, unsigned int);
void rtm_addr(struct rtentry *, int, struct ifaddr *);
void rtm_miss(int, struct rt_addrinfo *, int, uint8_t, u_int, int, u_int);
int rt_setgate(struct rtentry *, struct sockaddr *, u_int);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index a20973e8ab1..0472366c566 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.242 2017/07/26 20:32:58 anton Exp $ */
+/* $OpenBSD: rtsock.c,v 1.243 2017/07/28 09:01:09 mpi Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -1373,7 +1373,7 @@ again:
}
void
-rtm_send(struct rtentry *rt, int cmd, u_int rtableid)
+rtm_send(struct rtentry *rt, int cmd, int error, unsigned int rtableid)
{
struct rt_addrinfo info;
struct ifnet *ifp;
@@ -1392,7 +1392,7 @@ rtm_send(struct rtentry *rt, int cmd, u_int rtableid)
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
- rtm_miss(cmd, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx, 0,
+ rtm_miss(cmd, &info, rt->rt_flags, rt->rt_priority, rt->rt_ifidx, error,
rtableid);
if_put(ifp);
}