summaryrefslogtreecommitdiffstats
path: root/sys/net/radix.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2008-05-09 07:39:31 +0000
committerclaudio <claudio@openbsd.org>2008-05-09 07:39:31 +0000
commit78bae52fd97156689501e187828f053d17bb538c (patch)
tree1824ca69cefce76239bac63b8f988e836dabdea4 /sys/net/radix.c
parentwhen cloning, copy the priority from the parent to the cloned route, (diff)
downloadwireguard-openbsd-78bae52fd97156689501e187828f053d17bb538c.tar.xz
wireguard-openbsd-78bae52fd97156689501e187828f053d17bb538c.zip
Fix a logic botch around prioinv that resulted in wrong ordering of more
specific routes. OK henning@
Diffstat (limited to 'sys/net/radix.c')
-rw-r--r--sys/net/radix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index 116d68e2b69..bbc8a779b16 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix.c,v 1.22 2008/05/07 05:14:21 claudio Exp $ */
+/* $OpenBSD: radix.c,v 1.23 2008/05/09 07:39:31 claudio Exp $ */
/* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */
/*
@@ -511,7 +511,7 @@ rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
struct radix_node *t, *x = NULL, *tt;
struct radix_node *saved_tt, *top = head->rnh_treetop;
short b = 0, b_leaf = 0;
- int keyduplicated, prioinv = 0;
+ int keyduplicated, prioinv = -1;
caddr_t mmask;
struct radix_mask *m, **mp;
@@ -548,6 +548,7 @@ rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
* Additionally keep the list sorted by route
* priority.
*/
+ prioinv = 0;
tt = rn_mpath_prio(tt, prio);
if (((struct rtentry *)tt)->rt_priority !=
prio) {
@@ -608,7 +609,7 @@ rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
x->rn_r = tt;
saved_tt = tt;
x = xx;
- } else if (prioinv) {
+ } else if (prioinv == 1) {
(tt = treenodes)->rn_dupedkey = t;
if (t->rn_p == NULL)
panic("rn_addroute: t->rn_p is NULL");