Commit 2e655571 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

ipv4: fib_trie: Fix lookup error return

In commit a07f5f50 "[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: default avatarBen Hutchings <bhutchings@solarflare.com>
Tested-by: default avatarWilliam Boughton <bill@boughton.de>
Acked-by: default avatarStephen Heminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d8ea1fd
...@@ -1359,17 +1359,17 @@ static int check_leaf(struct trie *t, struct leaf *l, ...@@ -1359,17 +1359,17 @@ static int check_leaf(struct trie *t, struct leaf *l,
t->stats.semantic_match_miss++; t->stats.semantic_match_miss++;
#endif #endif
if (err <= 0) if (err <= 0)
return plen; return err;
} }
return -1; return 1;
} }
static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
struct fib_result *res) struct fib_result *res)
{ {
struct trie *t = (struct trie *) tb->tb_data; struct trie *t = (struct trie *) tb->tb_data;
int plen, ret = 0; int ret;
struct node *n; struct node *n;
struct tnode *pn; struct tnode *pn;
int pos, bits; int pos, bits;
...@@ -1393,10 +1393,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, ...@@ -1393,10 +1393,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
/* Just a leaf? */ /* Just a leaf? */
if (IS_LEAF(n)) { if (IS_LEAF(n)) {
plen = check_leaf(t, (struct leaf *)n, key, flp, res); ret = check_leaf(t, (struct leaf *)n, key, flp, res);
if (plen < 0)
goto failed;
ret = 0;
goto found; goto found;
} }
...@@ -1421,11 +1418,9 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, ...@@ -1421,11 +1418,9 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp,
} }
if (IS_LEAF(n)) { if (IS_LEAF(n)) {
plen = check_leaf(t, (struct leaf *)n, key, flp, res); ret = check_leaf(t, (struct leaf *)n, key, flp, res);
if (plen < 0) if (ret > 0)
goto backtrace; goto backtrace;
ret = 0;
goto found; goto found;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment