Skip to content

Commit

Permalink
[IPV4] fib_trie: missing ntohl() when calling fib_semantic_match()
Browse files Browse the repository at this point in the history
fib_trie.c::check_leaf() passes host-endian where fib_semantic_match()
expects (and stores into) net-endian.

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Al Viro authored and davem330 committed Sep 19, 2006
1 parent b22b900 commit 888454c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,18 +1281,18 @@ static inline int check_leaf(struct trie *t, struct leaf *l,
struct fib_result *res)
{
int err, i;
t_key mask;
__be32 mask;
struct leaf_info *li;
struct hlist_head *hhead = &l->list;
struct hlist_node *node;

hlist_for_each_entry_rcu(li, node, hhead, hlist) {
i = li->plen;
mask = ntohl(inet_make_mask(i));
if (l->key != (key & mask))
mask = inet_make_mask(i);
if (l->key != (key & ntohl(mask)))
continue;

if ((err = fib_semantic_match(&li->falh, flp, res, l->key, mask, i)) <= 0) {
if ((err = fib_semantic_match(&li->falh, flp, res, htonl(l->key), mask, i)) <= 0) {
*plen = i;
#ifdef CONFIG_IP_FIB_TRIE_STATS
t->stats.semantic_match_passed++;
Expand Down

0 comments on commit 888454c

Please sign in to comment.