summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-05-09 07:39:32 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-05-09 07:39:32 +0000
commit239c3bdd554989379fb2e7b923658ec5dc632320 (patch)
tree52c736c5d71a71dc579aa1a8f7437d33405803ae /sys
parentd75e8abf1a42503fac7bfb35eefe6b17c8824035 (diff)
Fix a logic botch around prioinv that resulted in wrong ordering of more
specific routes. OK henning@
Diffstat (limited to 'sys')
-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");