diff options
author | Andy Walls <awalls@md.metrocast.net> | 2010-10-17 11:11:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-18 10:22:50 -0400 |
commit | 27a954bd560f3e385bbed38fde3051fe718b8d75 (patch) | |
tree | 83d46eb7d984fd1cd5eaa55c20267a88b4ab9a3a /net/ipv4/route.c | |
parent | a47d60561e111f5009ad0964069cfff77f76dbaa (diff) |
IPv4: route.c: Change checks against 0xffffffff to ipv4_is_lbcast()
Change a few checks against the hardcoded broadcast address,
0xffffffff, to ipv4_is_lbcast(). Remove some existing checks
using ipv4_is_lbcast() that are now obviously superfluous.
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 0755aa4af86c..ff98983d2a45 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2124,7 +2124,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2124 | ipv4_is_loopback(saddr)) | 2124 | ipv4_is_loopback(saddr)) |
2125 | goto martian_source; | 2125 | goto martian_source; |
2126 | 2126 | ||
2127 | if (daddr == htonl(0xFFFFFFFF) || (saddr == 0 && daddr == 0)) | 2127 | if (ipv4_is_lbcast(daddr) || (saddr == 0 && daddr == 0)) |
2128 | goto brd_input; | 2128 | goto brd_input; |
2129 | 2129 | ||
2130 | /* Accept zero addresses only to limited broadcast; | 2130 | /* Accept zero addresses only to limited broadcast; |
@@ -2133,8 +2133,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2133 | if (ipv4_is_zeronet(saddr)) | 2133 | if (ipv4_is_zeronet(saddr)) |
2134 | goto martian_source; | 2134 | goto martian_source; |
2135 | 2135 | ||
2136 | if (ipv4_is_lbcast(daddr) || ipv4_is_zeronet(daddr) || | 2136 | if (ipv4_is_zeronet(daddr) || ipv4_is_loopback(daddr)) |
2137 | ipv4_is_loopback(daddr)) | ||
2138 | goto martian_destination; | 2137 | goto martian_destination; |
2139 | 2138 | ||
2140 | /* | 2139 | /* |
@@ -2367,11 +2366,11 @@ static int __mkroute_output(struct rtable **result, | |||
2367 | if (ipv4_is_loopback(fl->fl4_src) && !(dev_out->flags & IFF_LOOPBACK)) | 2366 | if (ipv4_is_loopback(fl->fl4_src) && !(dev_out->flags & IFF_LOOPBACK)) |
2368 | return -EINVAL; | 2367 | return -EINVAL; |
2369 | 2368 | ||
2370 | if (fl->fl4_dst == htonl(0xFFFFFFFF)) | 2369 | if (ipv4_is_lbcast(fl->fl4_dst)) |
2371 | res->type = RTN_BROADCAST; | 2370 | res->type = RTN_BROADCAST; |
2372 | else if (ipv4_is_multicast(fl->fl4_dst)) | 2371 | else if (ipv4_is_multicast(fl->fl4_dst)) |
2373 | res->type = RTN_MULTICAST; | 2372 | res->type = RTN_MULTICAST; |
2374 | else if (ipv4_is_lbcast(fl->fl4_dst) || ipv4_is_zeronet(fl->fl4_dst)) | 2373 | else if (ipv4_is_zeronet(fl->fl4_dst)) |
2375 | return -EINVAL; | 2374 | return -EINVAL; |
2376 | 2375 | ||
2377 | if (dev_out->flags & IFF_LOOPBACK) | 2376 | if (dev_out->flags & IFF_LOOPBACK) |
@@ -2530,7 +2529,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
2530 | 2529 | ||
2531 | if (oldflp->oif == 0 && | 2530 | if (oldflp->oif == 0 && |
2532 | (ipv4_is_multicast(oldflp->fl4_dst) || | 2531 | (ipv4_is_multicast(oldflp->fl4_dst) || |
2533 | oldflp->fl4_dst == htonl(0xFFFFFFFF))) { | 2532 | ipv4_is_lbcast(oldflp->fl4_dst))) { |
2534 | /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ | 2533 | /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ |
2535 | dev_out = __ip_dev_find(net, oldflp->fl4_src, false); | 2534 | dev_out = __ip_dev_find(net, oldflp->fl4_src, false); |
2536 | if (dev_out == NULL) | 2535 | if (dev_out == NULL) |
@@ -2574,7 +2573,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
2574 | goto out; /* Wrong error code */ | 2573 | goto out; /* Wrong error code */ |
2575 | 2574 | ||
2576 | if (ipv4_is_local_multicast(oldflp->fl4_dst) || | 2575 | if (ipv4_is_local_multicast(oldflp->fl4_dst) || |
2577 | oldflp->fl4_dst == htonl(0xFFFFFFFF)) { | 2576 | ipv4_is_lbcast(oldflp->fl4_dst)) { |
2578 | if (!fl.fl4_src) | 2577 | if (!fl.fl4_src) |
2579 | fl.fl4_src = inet_select_addr(dev_out, 0, | 2578 | fl.fl4_src = inet_select_addr(dev_out, 0, |
2580 | RT_SCOPE_LINK); | 2579 | RT_SCOPE_LINK); |