diff options
author | qingli <qingli@FreeBSD.org> | 2006-02-07 20:25:39 +0000 |
---|---|---|
committer | qingli <qingli@FreeBSD.org> | 2006-02-07 20:25:39 +0000 |
commit | d6ddb869d26b9bf973b27926265ea63c6a1e9aa0 (patch) | |
tree | d2d552d5d91709db46a5b9ffec084add783aa8ca /sys/net/radix.c | |
parent | a40b4d8d503683958fef7a33bbb2b7620751c9ef (diff) | |
download | FreeBSD-src-d6ddb869d26b9bf973b27926265ea63c6a1e9aa0.zip FreeBSD-src-d6ddb869d26b9bf973b27926265ea63c6a1e9aa0.tar.gz |
The code in rn_walktree_from() that checks if we backed up too far
did not stop at the right node. Change the backtracking check from
smaller-than to smaller-or-equal to prevent this from happening.
While here fix one additional problem where the insertion of the
default route traversed the entire tree.
PR: kern/38752
Submitted by: qingli (before I became committer)
Reviewed by: andre
MFC after: 3 days
Diffstat (limited to 'sys/net/radix.c')
-rw-r--r-- | sys/net/radix.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c index 3e8ef97..0f718b7 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -1006,7 +1006,7 @@ rn_walktree_from(h, a, m, f, w) rn = rn->rn_parent; /* if went up beyond last, stop */ - if (rn->rn_bit < lastb) { + if (rn->rn_bit <= lastb) { stopping = 1; /* printf("up too far\n"); */ /* @@ -1018,6 +1018,14 @@ rn_walktree_from(h, a, m, f, w) */ } } + + /* + * At the top of the tree, no need to traverse the right + * half, prevent the traversal of the entire tree in the + * case of default route. + */ + if (rn->rn_parent->rn_flags & RNF_ROOT) + stopping = 1; /* Find the next *leaf* since next node might vanish, too */ for (rn = rn->rn_parent->rn_right; rn->rn_bit >= 0;) |