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:
Ben Hutchings 2008-07-10 16:52:52 -07:00 committed by David S. Miller
parent 3d8ea1fd70
commit 2e655571c6

View File

@ -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,
/* 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,
} }
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;
} }