summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-03-04 15:53:29 +0000
committerclaudio <claudio@openbsd.org>2015-03-04 15:53:29 +0000
commitcdfb1f0aa97c8877295ab002d31c218506136b1e (patch)
tree00a7d21507c2992d68d72c5550fc695c8da6e5be
parentstop the calibration timeout when stopping the interface (diff)
downloadwireguard-openbsd-cdfb1f0aa97c8877295ab002d31c218506136b1e.tar.xz
wireguard-openbsd-cdfb1f0aa97c8877295ab002d31c218506136b1e.zip
Make sure that rn_mpath_adj_mpflag() is called with the correct pointer
to the multipath chain when removing routes. This fixes the sbin/route testcases 17-19 and fixes an annoying opsfd bug because of routes wrongly marked as multipath ones. OK deraadt, mpi, sthen, benno, phessler
-rw-r--r--sys/net/radix.c7
-rw-r--r--sys/net/radix_mpath.c5
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index e88946ca90b..f8eca3630cd 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix.c,v 1.43 2014/12/02 18:11:56 tedu Exp $ */
+/* $OpenBSD: radix.c,v 1.44 2015/03/04 15:53:29 claudio Exp $ */
/* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */
/*
@@ -1009,8 +1009,13 @@ rn_delete(void *v_arg, void *n_arg, struct radix_node_head *head,
tp->rn_l = x;
else
tp->rn_r = x;
+ /* head changed adjust dupedkey pointer */
+ dupedkey_tt = x;
} else {
x = saved_tt;
+ /* dupedkey will change so adjust pointer */
+ if (dupedkey_tt == tt)
+ dupedkey_tt = tt->rn_dupedkey;
tp->rn_dupedkey = tt->rn_dupedkey;
if (tt->rn_dupedkey)
tt->rn_dupedkey->rn_p = tp;
diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c
index 9622b8ac68a..9560fd6d9bc 100644
--- a/sys/net/radix_mpath.c
+++ b/sys/net/radix_mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.c,v 1.28 2015/02/06 01:21:17 mpi Exp $ */
+/* $OpenBSD: radix_mpath.c,v 1.29 2015/03/04 15:53:29 claudio Exp $ */
/* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */
/*
@@ -146,6 +146,9 @@ rn_mpath_adj_mpflag(struct radix_node *rn, u_int8_t prio)
{
struct rtentry *rt = (struct rtentry *)rn;
+ if (!rn)
+ return;
+
prio &= RTP_MASK;
rt = rt_mpath_matchgate(rt, NULL, prio);
rn = (struct radix_node *)rt;