aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-08-24 01:06:09 -0400
committerDavid S. Miller <davem@davemloft.net>2005-08-24 01:06:09 -0400
commit06c7427021f1cc83703f14659d8405ca773ba1ef (patch)
tree01d66754d441b84cb09fe28f875cbb47b3b9fb0c /net/ipv4/fib_trie.c
parent0572e3da3ff5c3744b2f606ecf296d5f89a4bbdf (diff)
[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 <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index a701405fab0b..45efd5f4741b 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1333,9 +1333,9 @@ err:;
1333} 1333}
1334 1334
1335static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp, 1335static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp,
1336 struct fib_result *res, int *err) 1336 struct fib_result *res)
1337{ 1337{
1338 int i; 1338 int err, i;
1339 t_key mask; 1339 t_key mask;
1340 struct leaf_info *li; 1340 struct leaf_info *li;
1341 struct hlist_head *hhead = &l->list; 1341 struct hlist_head *hhead = &l->list;
@@ -1348,18 +1348,18 @@ static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *pl
1348 if (l->key != (key & mask)) 1348 if (l->key != (key & mask))
1349 continue; 1349 continue;
1350 1350
1351 if (((*err) = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) == 0) { 1351 if ((err = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) <= 0) {
1352 *plen = i; 1352 *plen = i;
1353#ifdef CONFIG_IP_FIB_TRIE_STATS 1353#ifdef CONFIG_IP_FIB_TRIE_STATS
1354 t->stats.semantic_match_passed++; 1354 t->stats.semantic_match_passed++;
1355#endif 1355#endif
1356 return 1; 1356 return err;
1357 } 1357 }
1358#ifdef CONFIG_IP_FIB_TRIE_STATS 1358#ifdef CONFIG_IP_FIB_TRIE_STATS
1359 t->stats.semantic_match_miss++; 1359 t->stats.semantic_match_miss++;
1360#endif 1360#endif
1361 } 1361 }
1362 return 0; 1362 return 1;
1363} 1363}
1364 1364
1365static int 1365static int
@@ -1386,7 +1386,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
1386 1386
1387 /* Just a leaf? */ 1387 /* Just a leaf? */
1388 if (IS_LEAF(n)) { 1388 if (IS_LEAF(n)) {
1389 if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret)) 1389 if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
1390 goto found; 1390 goto found;
1391 goto failed; 1391 goto failed;
1392 } 1392 }
@@ -1508,7 +1508,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
1508 continue; 1508 continue;
1509 } 1509 }
1510 if (IS_LEAF(n)) { 1510 if (IS_LEAF(n)) {
1511 if (check_leaf(t, (struct leaf *)n, key, &plen, flp, res, &ret)) 1511 if ((ret = check_leaf(t, (struct leaf *)n, key, &plen, flp, res)) <= 0)
1512 goto found; 1512 goto found;
1513 } 1513 }
1514backtrace: 1514backtrace: