summaryrefslogtreecommitdiff
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
parent2f27f1f1e864032ed15dc0fd9fe45906e7ab148d (diff)
Add an error argument to rtm_send() instead of rerolling it inside
rtdeletemsg(). ok bluhm@
-rw-r--r--sys/net/route.c16
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/net/rtsock.c6
-rw-r--r--sys/netinet/if_ether.c4
-rw-r--r--sys/netinet6/nd6_nbr.c4
5 files changed, 14 insertions, 20 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);
}
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 3338ace2558..49e5d84f525 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.228 2017/03/06 08:56:39 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.229 2017/07/28 09:01:09 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -650,7 +650,7 @@ arpcache(struct ifnet *ifp, struct ether_arp *ea, struct rtentry *rt)
/* Notify userland that an ARP resolution has been done. */
if (la->la_asked || changed) {
KERNEL_LOCK();
- rtm_send(rt, RTM_RESOLVE, ifp->if_rdomain);
+ rtm_send(rt, RTM_RESOLVE, 0, ifp->if_rdomain);
KERNEL_UNLOCK();
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 9c6fa4bf163..90086d33d65 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.119 2017/07/11 12:51:05 florian Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.120 2017/07/28 09:01:09 mpi Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -721,7 +721,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
ln->ln_byhint = 0;
/* Notify userland that a new ND entry is reachable. */
KERNEL_LOCK();
- rtm_send(rt, RTM_RESOLVE, ifp->if_rdomain);
+ rtm_send(rt, RTM_RESOLVE, 0, ifp->if_rdomain);
KERNEL_UNLOCK();
if (!ND6_LLINFO_PERMANENT(ln)) {
nd6_llinfo_settimer(ln,