aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/in.h5
-rw-r--r--include/net/addrconf.h2
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/route.c12
5 files changed, 12 insertions, 11 deletions
diff --git a/include/linux/in.h b/include/linux/in.h
index 27d8a5ae9f75..70c6df882694 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -262,9 +262,10 @@ static inline bool ipv4_is_local_multicast(__be32 addr)
262 return (addr & htonl(0xffffff00)) == htonl(0xe0000000); 262 return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
263} 263}
264 264
265static inline bool ipv4_is_badclass(__be32 addr) 265static inline bool ipv4_is_lbcast(__be32 addr)
266{ 266{
267 return (addr & htonl(0xf0000000)) == htonl(0xf0000000); 267 /* limited broadcast */
268 return addr == INADDR_BROADCAST;
268} 269}
269 270
270static inline bool ipv4_is_zeronet(__be32 addr) 271static inline bool ipv4_is_zeronet(__be32 addr)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 8b1509bfc695..496503c03846 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -262,7 +262,7 @@ static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr)
262 ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || 262 ipv4_is_private_172(addr) || ipv4_is_test_192(addr) ||
263 ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || 263 ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) ||
264 ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || 264 ipv4_is_test_198(addr) || ipv4_is_multicast(addr) ||
265 ipv4_is_badclass(addr)) ? 0x00 : 0x02; 265 ipv4_is_lbcast(addr)) ? 0x00 : 0x02;
266 eui[1] = 0; 266 eui[1] = 0;
267 eui[2] = 0x5E; 267 eui[2] = 0x5E;
268 eui[3] = 0xFE; 268 eui[3] = 0xFE;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d18fdb102360..eebccdbdbaca 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2266,7 +2266,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
2266 2266
2267 while (ipv4_is_loopback(s) || 2267 while (ipv4_is_loopback(s) ||
2268 ipv4_is_multicast(s) || 2268 ipv4_is_multicast(s) ||
2269 ipv4_is_badclass(s) || 2269 ipv4_is_lbcast(s) ||
2270 ipv4_is_zeronet(s) || 2270 ipv4_is_zeronet(s) ||
2271 ipv4_is_local_multicast(s)) { 2271 ipv4_is_local_multicast(s)) {
2272 t = random32() % (imx - imn) + imn; 2272 t = random32() % (imx - imn) + imn;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 62bd791c204e..8987046d97f3 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -176,7 +176,7 @@ static inline unsigned __inet_dev_addr_type(struct net *net,
176 unsigned ret = RTN_BROADCAST; 176 unsigned ret = RTN_BROADCAST;
177 struct fib_table *local_table; 177 struct fib_table *local_table;
178 178
179 if (ipv4_is_zeronet(addr) || ipv4_is_badclass(addr)) 179 if (ipv4_is_zeronet(addr) || ipv4_is_lbcast(addr))
180 return RTN_BROADCAST; 180 return RTN_BROADCAST;
181 if (ipv4_is_multicast(addr)) 181 if (ipv4_is_multicast(addr))
182 return RTN_MULTICAST; 182 return RTN_MULTICAST;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fc0145385e80..f80c761ea0bb 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1154,7 +1154,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1154 return; 1154 return;
1155 1155
1156 if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) 1156 if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev)
1157 || ipv4_is_multicast(new_gw) || ipv4_is_badclass(new_gw) 1157 || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw)
1158 || ipv4_is_zeronet(new_gw)) 1158 || ipv4_is_zeronet(new_gw))
1159 goto reject_redirect; 1159 goto reject_redirect;
1160 1160
@@ -1634,7 +1634,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1634 if (in_dev == NULL) 1634 if (in_dev == NULL)
1635 return -EINVAL; 1635 return -EINVAL;
1636 1636
1637 if (ipv4_is_multicast(saddr) || ipv4_is_badclass(saddr) || 1637 if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) ||
1638 ipv4_is_loopback(saddr) || skb->protocol != htons(ETH_P_IP)) 1638 ipv4_is_loopback(saddr) || skb->protocol != htons(ETH_P_IP))
1639 goto e_inval; 1639 goto e_inval;
1640 1640
@@ -1891,7 +1891,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1891 by fib_lookup. 1891 by fib_lookup.
1892 */ 1892 */
1893 1893
1894 if (ipv4_is_multicast(saddr) || ipv4_is_badclass(saddr) || 1894 if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) ||
1895 ipv4_is_loopback(saddr)) 1895 ipv4_is_loopback(saddr))
1896 goto martian_source; 1896 goto martian_source;
1897 1897
@@ -1904,7 +1904,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1904 if (ipv4_is_zeronet(saddr)) 1904 if (ipv4_is_zeronet(saddr))
1905 goto martian_source; 1905 goto martian_source;
1906 1906
1907 if (ipv4_is_badclass(daddr) || ipv4_is_zeronet(daddr) || 1907 if (ipv4_is_lbcast(daddr) || ipv4_is_zeronet(daddr) ||
1908 ipv4_is_loopback(daddr)) 1908 ipv4_is_loopback(daddr))
1909 goto martian_destination; 1909 goto martian_destination;
1910 1910
@@ -2125,7 +2125,7 @@ static inline int __mkroute_output(struct rtable **result,
2125 res->type = RTN_BROADCAST; 2125 res->type = RTN_BROADCAST;
2126 else if (ipv4_is_multicast(fl->fl4_dst)) 2126 else if (ipv4_is_multicast(fl->fl4_dst))
2127 res->type = RTN_MULTICAST; 2127 res->type = RTN_MULTICAST;
2128 else if (ipv4_is_badclass(fl->fl4_dst) || ipv4_is_zeronet(fl->fl4_dst)) 2128 else if (ipv4_is_lbcast(fl->fl4_dst) || ipv4_is_zeronet(fl->fl4_dst))
2129 return -EINVAL; 2129 return -EINVAL;
2130 2130
2131 if (dev_out->flags & IFF_LOOPBACK) 2131 if (dev_out->flags & IFF_LOOPBACK)
@@ -2276,7 +2276,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2276 if (oldflp->fl4_src) { 2276 if (oldflp->fl4_src) {
2277 err = -EINVAL; 2277 err = -EINVAL;
2278 if (ipv4_is_multicast(oldflp->fl4_src) || 2278 if (ipv4_is_multicast(oldflp->fl4_src) ||
2279 ipv4_is_badclass(oldflp->fl4_src) || 2279 ipv4_is_lbcast(oldflp->fl4_src) ||
2280 ipv4_is_zeronet(oldflp->fl4_src)) 2280 ipv4_is_zeronet(oldflp->fl4_src))
2281 goto out; 2281 goto out;
2282 2282