Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -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;
		}