summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2018-11-23 16:24:12 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2018-11-23 16:24:12 +0000
commit7c3223e61b2970a8aa927317431392280500c3bd (patch)
tree64ce344b171c61cf4703ecc4185c93fbbace16ac /sys/net
parentb9c58db74d4ec791c9968b9b4a9a40bec198970e (diff)
Change rtable_mpath_reprio() to take the prefixlen as argument instead of
the network mask. This saves converting the prefixlen to a mask and back. OK phessler@, benno@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/route.c10
-rw-r--r--sys/net/rtable.c8
-rw-r--r--sys/net/rtable.h6
3 files changed, 10 insertions, 14 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 7f21d9f118d..ff3142d6548 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.378 2018/09/27 12:36:57 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.379 2018/11/23 16:24:11 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1626,8 +1626,8 @@ rt_if_linkstate_change(struct rtentry *rt, void *arg, u_int id)
/* bring route up */
rt->rt_flags |= RTF_UP;
- error = rtable_mpath_reprio(id, rt_key(rt),
- rt_plen2mask(rt, &sa_mask), rt->rt_priority & RTP_MASK, rt);
+ error = rtable_mpath_reprio(id, rt_key(rt), rt_plen(rt),
+ rt->rt_priority & RTP_MASK, rt);
} else {
/*
* Remove redirected and cloned routes (mainly ARP)
@@ -1646,8 +1646,8 @@ rt_if_linkstate_change(struct rtentry *rt, void *arg, u_int id)
/* take route down */
rt->rt_flags &= ~RTF_UP;
- error = rtable_mpath_reprio(id, rt_key(rt),
- rt_plen2mask(rt, &sa_mask), rt->rt_priority | RTP_DOWN, rt);
+ error = rtable_mpath_reprio(id, rt_key(rt), rt_plen(rt),
+ rt->rt_priority | RTP_DOWN, rt);
}
if_group_routechange(rt_key(rt), rt_plen2mask(rt, &sa_mask));
diff --git a/sys/net/rtable.c b/sys/net/rtable.c
index 647ad7f7646..8aaf4c63a7f 100644
--- a/sys/net/rtable.c
+++ b/sys/net/rtable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtable.c,v 1.66 2018/11/20 10:28:08 claudio Exp $ */
+/* $OpenBSD: rtable.c,v 1.67 2018/11/23 16:24:11 claudio Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
@@ -731,13 +731,12 @@ rtable_mpath_capable(unsigned int rtableid, sa_family_t af)
int
rtable_mpath_reprio(unsigned int rtableid, struct sockaddr *dst,
- struct sockaddr *mask, uint8_t prio, struct rtentry *rt)
+ int plen, uint8_t prio, struct rtentry *rt)
{
struct art_root *ar;
struct art_node *an;
struct srp_ref sr;
uint8_t *addr;
- int plen;
int error = 0;
ar = rtable_get(rtableid, dst->sa_family);
@@ -745,9 +744,6 @@ rtable_mpath_reprio(unsigned int rtableid, struct sockaddr *dst,
return (EAFNOSUPPORT);
addr = satoaddr(ar, dst);
- plen = rtable_satoplen(dst->sa_family, mask);
- if (plen == -1)
- return (EINVAL);
rw_enter_write(&ar->ar_lock);
an = art_lookup(ar, addr, plen, &sr);
diff --git a/sys/net/rtable.h b/sys/net/rtable.h
index 57093723d4f..ea78d8bed06 100644
--- a/sys/net/rtable.h
+++ b/sys/net/rtable.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtable.h,v 1.21 2018/09/09 10:07:38 henning Exp $ */
+/* $OpenBSD: rtable.h,v 1.22 2018/11/23 16:24:11 claudio Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
@@ -70,6 +70,6 @@ int rtable_walk(unsigned int, sa_family_t,
int rtable_mpath_capable(unsigned int, sa_family_t);
struct rtentry *rtable_mpath_match(unsigned int, struct rtentry *,
struct sockaddr *, uint8_t);
-int rtable_mpath_reprio(unsigned int, struct sockaddr *,
- struct sockaddr *, uint8_t, struct rtentry *);
+int rtable_mpath_reprio(unsigned int, struct sockaddr *, int,
+ uint8_t, struct rtentry *);
#endif /* _NET_RTABLE_H_ */