* [PATCH] [IPV4] fib_trie: Fix lookup error return
@ 2008-07-10 13:23 Ben Hutchings
2008-07-10 17:54 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2008-07-10 13:23 UTC (permalink / raw)
To: David Miller; +Cc: William Boughton, netdev, stephen.hemminger
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>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 394db9c..43ed894 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1357,17 +1357,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;
@@ -1391,10 +1391,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;
}
@@ -1419,11 +1416,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;
}
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [IPV4] fib_trie: Fix lookup error return
2008-07-10 13:23 [PATCH] [IPV4] fib_trie: Fix lookup error return Ben Hutchings
@ 2008-07-10 17:54 ` Stephen Hemminger
2008-07-10 23:52 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-07-10 17:54 UTC (permalink / raw)
To: Ben Hutchings; +Cc: David Miller, William Boughton, netdev, stephen.hemminger
On Thu, 10 Jul 2008 14:23:37 +0100
Ben Hutchings <bhutchings@solarflare.com> wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [IPV4] fib_trie: Fix lookup error return
2008-07-10 17:54 ` Stephen Hemminger
@ 2008-07-10 23:52 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-07-10 23:52 UTC (permalink / raw)
To: shemminger; +Cc: bhutchings, bill, netdev, stephen.hemminger
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Thu, 10 Jul 2008 10:54:50 -0700
> On Thu, 10 Jul 2008 14:23:37 +0100
> Ben Hutchings <bhutchings@solarflare.com> wrote:
>
> > 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>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-10 23:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 13:23 [PATCH] [IPV4] fib_trie: Fix lookup error return Ben Hutchings
2008-07-10 17:54 ` Stephen Hemminger
2008-07-10 23:52 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).