mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
ipv4: fib_trie: Fix lookup error return
In commit a07f5f508a
"[IPV4] fib_trie: style
cleanup", the changes to check_leaf() and fn_trie_lookup() were wrong - where
fn_trie_lookup() would previously return a negative error value from
check_leaf(), it now returns 0.
Now fn_trie_lookup() doesn't appear to care about plen, so we can revert
check_leaf() to returning the error value.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Tested-by: William Boughton <bill@boughton.de>
Acked-by: Stephen Heminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3d8ea1fd70
commit
2e655571c6
@ -1359,17 +1359,17 @@ static int check_leaf(struct trie *t, struct leaf *l,
|
||||
t->stats.semantic_match_miss++;
|
||||
#endif
|
||||
if (err <= 0)
|
||||
return plen;
|
||||
return err;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
|
||||
struct fib_result *res)
|
||||
{
|
||||
struct trie *t = (struct trie *) tb->tb_data;
|
||||
int plen, ret = 0;
|
||||
int ret;
|
||||
struct node *n;
|
||||
struct tnode *pn;
|
||||
int pos, bits;
|
||||
@ -1393,10 +1393,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
|
||||
|
||||
/* Just a leaf? */
|
||||
if (IS_LEAF(n)) {
|
||||
plen = check_leaf(t, (struct leaf *)n, key, flp, res);
|
||||
if (plen < 0)
|
||||
goto failed;
|
||||
ret = 0;
|
||||
ret = check_leaf(t, (struct leaf *)n, key, flp, res);
|
||||
goto found;
|
||||
}
|
||||
|
||||
@ -1421,11 +1418,9 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
|
||||
}
|
||||
|
||||
if (IS_LEAF(n)) {
|
||||
plen = check_leaf(t, (struct leaf *)n, key, flp, res);
|
||||
if (plen < 0)
|
||||
ret = check_leaf(t, (struct leaf *)n, key, flp, res);
|
||||
if (ret > 0)
|
||||
goto backtrace;
|
||||
|
||||
ret = 0;
|
||||
goto found;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user