[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>
This commit is contained in:
committed by
David S. Miller
parent
0572e3da3f
commit
06c7427021
@@ -1333,9 +1333,9 @@ err:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int check_leaf(struct trie *t, struct leaf *l, t_key key, int *plen, const struct flowi *flp,
|
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;
|
t_key mask;
|
||||||
struct leaf_info *li;
|
struct leaf_info *li;
|
||||||
struct hlist_head *hhead = &l->list;
|
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
|
|||||||
if (l->key != (key & mask))
|
if (l->key != (key & mask))
|
||||||
continue;
|
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;
|
*plen = i;
|
||||||
#ifdef CONFIG_IP_FIB_TRIE_STATS
|
#ifdef CONFIG_IP_FIB_TRIE_STATS
|
||||||
t->stats.semantic_match_passed++;
|
t->stats.semantic_match_passed++;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return err;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_IP_FIB_TRIE_STATS
|
#ifdef CONFIG_IP_FIB_TRIE_STATS
|
||||||
t->stats.semantic_match_miss++;
|
t->stats.semantic_match_miss++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1386,7 +1386,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
|
|||||||
|
|
||||||
/* Just a leaf? */
|
/* Just a leaf? */
|
||||||
if (IS_LEAF(n)) {
|
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 found;
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@@ -1508,7 +1508,7 @@ fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, struct fib_result
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (IS_LEAF(n)) {
|
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 found;
|
||||||
}
|
}
|
||||||
backtrace:
|
backtrace:
|
||||||
|
Reference in New Issue
Block a user