[IPV4] bug: broken open-coded inet_make_mask() (multipath_wrandom)
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 27 Sep 2006 05:26:21 +0000 (22:26 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 29 Sep 2006 01:01:17 +0000 (18:01 -0700)
multipath_wrandom.c::__multipath_lookup_weight() contains open-coded
attempt at inet_make_mask(); broken on big-endian.

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

index 32dbd6906a5d5e3c3c39a817fad1f4366055376e..92b04823e034292328be4cf92c2891ce8e05b9fd 100644 (file)
@@ -128,8 +128,8 @@ static unsigned char __multipath_lookup_weight(const struct flowi *fl,
 
        /* find state entry for destination */
        list_for_each_entry_rcu(d, &target_route->dests, list) {
-               __u32 targetnetwork = fl->fl4_dst & 
-                       (0xFFFFFFFF >> (32 - d->prefixlen));
+               __be32 targetnetwork = fl->fl4_dst &
+                       inet_make_mask(d->prefixlen);
 
                if ((targetnetwork & d->netmask) == d->network) {
                        weight = d->nh_info->nh_weight;