Thomas Graf wrote:

* Patrick McHardy <[EMAIL PROTECTED]> 2005-08-22 23:38

@@ -1364,7 +1365,7 @@ fn_trie_lookup(struct fib_table *tb, con
        }

        if (IS_LEAF(n)) {
- if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret)) + if ((ret == check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)


That fixed it, it boots fine now and passes Vladimir's testcase.
[FIB_TRIE]: Don't ignore negative results from fib_semantic_match

When a semantic match occurs either success, not found or an error
(for matching unreachable routes/blackholes) is returned. fib_trie
ignores the errors and looks for a different matching route. Treat
results other than "no match" as success and end lookup.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit 2d90ffdff3ee2364b961e9af8a372570389dc1ec
tree f2ce50bced9ab6641e496d382982c616bf30cd31
parent 6df63ba21bdeaa86141af3cf6c9d0829114dbe9c
author Patrick McHardy <[EMAIL PROTECTED]> Tue, 23 Aug 2005 00:41:24 +0200
committer Patrick McHardy <[EMAIL PROTECTED]> Tue, 23 Aug 2005 00:41:24 +0200

 net/ipv4/fib_trie.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1283,9 +1283,9 @@ err:
 }
 
 static inline int check_leaf(struct trie *t, struct leaf *l,  t_key key, int 
*plen, const struct flowi *flp,
-                            struct fib_result *res, int *err)
+                            struct fib_result *res)
 {
-       int i;
+       int err, i;
        t_key mask;
        struct leaf_info *li;
        struct hlist_head *hhead = &l->list;
@@ -1297,18 +1297,18 @@ static inline int check_leaf(struct trie
                if (l->key != (key & mask))
                        continue;
 
-               if (((*err) = fib_semantic_match(&li->falh, flp, res, l->key, 
mask, i)) == 0) {
+               if ((err = fib_semantic_match(&li->falh, flp, res, l->key, 
mask, i)) <= 0) {
                        *plen = i;
 #ifdef CONFIG_IP_FIB_TRIE_STATS
                        t->stats.semantic_match_passed++;
 #endif
-                       return 1;
+                       return err;
                }
 #ifdef CONFIG_IP_FIB_TRIE_STATS
                t->stats.semantic_match_miss++;
 #endif
        }
-       return 0;
+       return 1;
 }
 
 static int
@@ -1340,7 +1340,7 @@ fn_trie_lookup(struct fib_table *tb, con
 
        /* Just a leaf? */
        if (IS_LEAF(n)) {
-               if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret))
+               if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, 
res)) <= 0)
                        goto found;
                goto failed;
        }
@@ -1364,7 +1364,7 @@ fn_trie_lookup(struct fib_table *tb, con
                }
 
                if (IS_LEAF(n)) {
-                       if (check_leaf(t, (struct leaf *)n, key, &plen, flp, 
res, &ret))
+                       if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, 
flp, res)) <= 0)
                                goto found;
                        else
                                goto backtrace;

Reply via email to