]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[IPV4] fib_trie: missing ntohl() when calling fib_semantic_match()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 19 Sep 2006 20:42:46 +0000 (13:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Sep 2006 20:42:46 +0000 (13:42 -0700)
fib_trie.c::check_leaf() passes host-endian where fib_semantic_match()
expects (and stores into) net-endian.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/fib_trie.c

index 23fb9d9768e369ecc0093805add00cf3f251a158..01801c0f885d18d78d360e78653760d00913bca2 100644 (file)
@@ -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++;