diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-07-10 19:52:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-10 19:52:52 -0400 |
commit | 2e655571c618434c24ac2ca989374fdd84470d6d (patch) | |
tree | bf339af1fa392043afa9780d8f08e25ac6358a70 /net/ipv4/fib_trie.c | |
parent | 3d8ea1fd7001f39b5cc0ad2ff51696292ea3cfbf (diff) |
ipv4: fib_trie: Fix lookup error return
In commit a07f5f508a4d9728c8e57d7f66294bf5b254ff7f "[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>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r-- | net/ipv4/fib_trie.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 4b02d14e7ab9..e1600ad8fb0e 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1359,17 +1359,17 @@ static int check_leaf(struct trie *t, struct leaf *l, | |||
1359 | t->stats.semantic_match_miss++; | 1359 | t->stats.semantic_match_miss++; |
1360 | #endif | 1360 | #endif |
1361 | if (err <= 0) | 1361 | if (err <= 0) |
1362 | return plen; | 1362 | return err; |
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | return -1; | 1365 | return 1; |
1366 | } | 1366 | } |
1367 | 1367 | ||
1368 | static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, | 1368 | static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, |
1369 | struct fib_result *res) | 1369 | struct fib_result *res) |
1370 | { | 1370 | { |
1371 | struct trie *t = (struct trie *) tb->tb_data; | 1371 | struct trie *t = (struct trie *) tb->tb_data; |
1372 | int plen, ret = 0; | 1372 | int ret; |
1373 | struct node *n; | 1373 | struct node *n; |
1374 | struct tnode *pn; | 1374 | struct tnode *pn; |
1375 | int pos, bits; | 1375 | int pos, bits; |
@@ -1393,10 +1393,7 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, | |||
1393 | 1393 | ||
1394 | /* Just a leaf? */ | 1394 | /* Just a leaf? */ |
1395 | if (IS_LEAF(n)) { | 1395 | if (IS_LEAF(n)) { |
1396 | plen = check_leaf(t, (struct leaf *)n, key, flp, res); | 1396 | ret = check_leaf(t, (struct leaf *)n, key, flp, res); |
1397 | if (plen < 0) | ||
1398 | goto failed; | ||
1399 | ret = 0; | ||
1400 | goto found; | 1397 | goto found; |
1401 | } | 1398 | } |
1402 | 1399 | ||
@@ -1421,11 +1418,9 @@ static int fn_trie_lookup(struct fib_table *tb, const struct flowi *flp, | |||
1421 | } | 1418 | } |
1422 | 1419 | ||
1423 | if (IS_LEAF(n)) { | 1420 | if (IS_LEAF(n)) { |
1424 | plen = check_leaf(t, (struct leaf *)n, key, flp, res); | 1421 | ret = check_leaf(t, (struct leaf *)n, key, flp, res); |
1425 | if (plen < 0) | 1422 | if (ret > 0) |
1426 | goto backtrace; | 1423 | goto backtrace; |
1427 | |||
1428 | ret = 0; | ||
1429 | goto found; | 1424 | goto found; |
1430 | } | 1425 | } |
1431 | 1426 | ||