Skip to content

Commit 71be603

Browse files
committed
Fix broken outgoing connections caused by upstream kernel regression (#4267)
Upstream commit [1] caused regression in IPv4 routing which can cause some routes becoming broadcast even though they should be routed as unicast, e.g.: # ip route get 1.1.1.1 broadcast 1.1.1.1 via 192.168.122.1 dev enp0s3 src 192.168.122.204 uid 0 cache <local,brd> It's not entirely clear yet why it happens but this behavior seems to be triggered for instance when the SSDP integration sends the broadcast packet on HA startup. While this behavior is not described in the regression report [1], the commit cherry-picked from Linux master fixes the problems for us as well. Patches moved to version-specific folder, as this one shouldn't be applied on Raspberry Pi targets. [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/stable/[email protected]/ Fixes #4265 (cherry picked from commit 78bda4b)
1 parent 94fe13f commit 71be603

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
From 3a369be3f99ff577e09f8fc02703c7c9e4e74f3d Mon Sep 17 00:00:00 2001
2+
From: Stefan Agner <[email protected]>
3+
Date: Tue, 28 Mar 2023 12:02:10 +0200
4+
Subject: [PATCH] ipv6: add option to explicitly enable reachability test
5+
6+
Systems which act as host as well as router might prefer the host
7+
behavior. Currently the kernel does not allow to use IPv6 forwarding
8+
globally and at the same time use route reachability probing.
9+
10+
Add a compile time flag to enable route reachability probe in any
11+
case.
12+
13+
Signed-off-by: Stefan Agner <[email protected]>
14+
---
15+
net/ipv6/Kconfig | 9 +++++++++
16+
net/ipv6/route.c | 3 ++-
17+
2 files changed, 11 insertions(+), 1 deletion(-)
18+
19+
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
20+
index 1c9c686d9522f..ee4d9ca9d2e24 100644
21+
--- a/net/ipv6/Kconfig
22+
+++ b/net/ipv6/Kconfig
23+
@@ -48,6 +48,15 @@ config IPV6_OPTIMISTIC_DAD
24+
25+
If unsure, say N.
26+
27+
+config IPV6_REACHABILITY_PROBE
28+
+ bool "IPv6: Always use reachability probing (RFC 4191)"
29+
+ help
30+
+ By default reachability probing is disabled on router devices (when
31+
+ IPv6 forwarding is enabled). This option explicitly enables
32+
+ reachability probing always.
33+
+
34+
+ If unsure, say N.
35+
+
36+
config INET6_AH
37+
tristate "IPv6: AH transformation"
38+
select XFRM_AH
39+
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
40+
index 8ebfed5d63232..f1a61af0f5199 100644
41+
--- a/net/ipv6/route.c
42+
+++ b/net/ipv6/route.c
43+
@@ -2223,7 +2223,8 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
44+
45+
strict |= flags & RT6_LOOKUP_F_IFACE;
46+
strict |= flags & RT6_LOOKUP_F_IGNORE_LINKSTATE;
47+
- if (READ_ONCE(net->ipv6.devconf_all->forwarding) == 0)
48+
+ if (READ_ONCE(net->ipv6.devconf_all->forwarding) == 0 ||
49+
+ IS_ENABLED(CONFIG_IPV6_REACHABILITY_PROBE))
50+
strict |= RT6_LOOKUP_F_REACHABLE;
51+
52+
rcu_read_lock();
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
From f356e2a2604bfc26be8bc51bf83f6a023f06316f Mon Sep 17 00:00:00 2001
2+
From: Oscar Maes <[email protected]>
3+
Date: Wed, 27 Aug 2025 08:23:21 +0200
4+
Subject: [PATCH] net: ipv4: fix regression in local-broadcast routes
5+
6+
[ Upstream commit 5189446ba995556eaa3755a6e875bc06675b88bd ]
7+
8+
Commit 9e30ecf23b1b ("net: ipv4: fix incorrect MTU in broadcast routes")
9+
introduced a regression where local-broadcast packets would have their
10+
gateway set in __mkroute_output, which was caused by fi = NULL being
11+
removed.
12+
13+
Fix this by resetting the fib_info for local-broadcast packets. This
14+
preserves the intended changes for directed-broadcast packets.
15+
16+
17+
Fixes: 9e30ecf23b1b ("net: ipv4: fix incorrect MTU in broadcast routes")
18+
Reported-by: Brett A C Sheffield <[email protected]>
19+
Closes: https://lore.kernel.org/regressions/[email protected]
20+
Signed-off-by: Oscar Maes <[email protected]>
21+
Reviewed-by: David Ahern <[email protected]>
22+
Link: https://patch.msgid.link/[email protected]
23+
Signed-off-by: Paolo Abeni <[email protected]>
24+
---
25+
net/ipv4/route.c | 10 +++++++---
26+
1 file changed, 7 insertions(+), 3 deletions(-)
27+
28+
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
29+
index 9a5c9497b3931..261ddb6542a40 100644
30+
--- a/net/ipv4/route.c
31+
+++ b/net/ipv4/route.c
32+
@@ -2532,12 +2532,16 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
33+
!netif_is_l3_master(dev_out))
34+
return ERR_PTR(-EINVAL);
35+
36+
- if (ipv4_is_lbcast(fl4->daddr))
37+
+ if (ipv4_is_lbcast(fl4->daddr)) {
38+
type = RTN_BROADCAST;
39+
- else if (ipv4_is_multicast(fl4->daddr))
40+
+
41+
+ /* reset fi to prevent gateway resolution */
42+
+ fi = NULL;
43+
+ } else if (ipv4_is_multicast(fl4->daddr)) {
44+
type = RTN_MULTICAST;
45+
- else if (ipv4_is_zeronet(fl4->daddr))
46+
+ } else if (ipv4_is_zeronet(fl4->daddr)) {
47+
return ERR_PTR(-EINVAL);
48+
+ }
49+
50+
if (dev_out->flags & IFF_LOOPBACK)
51+
flags |= RTCF_LOCAL;

0 commit comments

Comments
 (0)