8aabbe2859945fb16b666fe448a5c04e044ee4d1
[openwrt/openwrt.git] /
1 From 94c821c74bf5fe0c25e09df5334a16f98608db90 Mon Sep 17 00:00:00 2001
2 From: Seth David Schoen <schoen@loyalty.org>
3 Date: Wed, 12 May 2021 21:37:49 -0700
4 Subject: [PATCH] ip: Treat IPv4 segment's lowest address as unicast
5
6 Treat only the highest, not the lowest, IPv4 address within a local
7 subnet as a broadcast address.
8
9 Signed-off-by: Seth David Schoen <schoen@loyalty.org>
10 Suggested-by: John Gilmore <gnu@toad.com>
11 Acked-by: Dave Taht <dave.taht@gmail.com>
12 Reviewed-by: David Ahern <dsahern@kernel.org>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=94c821c74bf5
15 ---
16 net/ipv4/fib_frontend.c | 4 +---
17 1 file changed, 1 insertion(+), 3 deletions(-)
18
19 --- a/net/ipv4/fib_frontend.c
20 +++ b/net/ipv4/fib_frontend.c
21 @@ -1129,10 +1129,8 @@ void fib_add_ifaddr(struct in_ifaddr *if
22 prefix, ifa->ifa_prefixlen, prim,
23 ifa->ifa_rt_priority);
24
25 - /* Add network specific broadcasts, when it takes a sense */
26 + /* Add the network broadcast address, when it makes sense */
27 if (ifa->ifa_prefixlen < 31) {
28 - fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix, 32,
29 - prim, 0);
30 fib_magic(RTM_NEWROUTE, RTN_BROADCAST, prefix | ~mask,
31 32, prim, 0);
32 arp_invalidate(dev, prefix | ~mask, false);