netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [REGRESSION][BISECTED][PATCH] net: ipv4: fix regression in broadcast routes
@ 2025-08-22 16:50 Brett A C Sheffield
  2025-08-23  1:32 ` Jakub Kicinski
  2025-08-28  8:17 ` [REGRESSION][BISECTED][PATCH] net: ipv4: fix regression in broadcast routes kernel test robot
  0 siblings, 2 replies; 18+ messages in thread
From: Brett A C Sheffield @ 2025-08-22 16:50 UTC (permalink / raw)
  To: regressions
  Cc: Brett A C Sheffield, netdev, stable, davem, dsahern, oscmaes92,
	kuba

Fix the regression introduced in 9e30ecf23b1b whereby IPv4 broadcast
packets were having their ethernet destination field mangled.  This
broke WOL magic packets and likely other IPv4 broadcast.

The regression can be observed by sending an IPv4 WOL packet using
the wakeonlan program to any ethernet address:

 wakeonlan 46:3b:ad:61:e0:5d

and capturing the packet with tcpdump:

 tcpdump -i eth0 -w /tmp/bad.cap dst port 9

The ethernet destination MUST be ff:ff:ff:ff:ff:ff for broadcast, but is
mangled with 9e30ecf23b1b applied.

Revert the change made in 9e30ecf23b1b and ensure the MTU value for
broadcast routes is retained by calling ip_dst_init_metrics() directly,
avoiding the need to enter the main code block in rt_set_nexthop().

Simplify the code path taken for broadcast packets back to the original
before the regression, adding only the call to ip_dst_init_metrics().

The broadcast_pmtu.sh selftest provided with the original patch still
passes with this patch applied.

Fixes: 9e30ecf23b1b ("net: ipv4: fix incorrect MTU in broadcast routes")
Signed-off-by: Brett A C Sheffield <bacs@librecast.net>
---
 net/ipv4/route.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f639a2ae881a..eaf78e128aca 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2588,6 +2588,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 	do_cache = true;
 	if (type == RTN_BROADCAST) {
 		flags |= RTCF_BROADCAST | RTCF_LOCAL;
+		fi = NULL;
 	} else if (type == RTN_MULTICAST) {
 		flags |= RTCF_MULTICAST | RTCF_LOCAL;
 		if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
@@ -2657,8 +2658,12 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 			rth->dst.output = ip_mc_output;
 			RT_CACHE_STAT_INC(out_slow_mc);
 		}
+		if (type == RTN_BROADCAST) {
+			/* ensure MTU value for broadcast routes is retained */
+			ip_dst_init_metrics(&rth->dst, res->fi->fib_metrics);
+		}
 #ifdef CONFIG_IP_MROUTE
-		if (type == RTN_MULTICAST) {
+		else if (type == RTN_MULTICAST) {
 			if (IN_DEV_MFORWARD(in_dev) &&
 			    !ipv4_is_local_multicast(fl4->daddr)) {
 				rth->dst.input = ip_mr_input;

base-commit: 01b9128c5db1b470575d07b05b67ffa3cb02ebf1
-- 
2.49.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-08-29  2:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 16:50 [REGRESSION][BISECTED][PATCH] net: ipv4: fix regression in broadcast routes Brett A C Sheffield
2025-08-23  1:32 ` Jakub Kicinski
2025-08-23 12:13   ` [PATCH v2 1/2] selftests: net: add test for broadcast destination Brett A C Sheffield
2025-08-23 12:13   ` [PATCH v2 2/2] net: ipv4: fix regression in broadcast routes Brett A C Sheffield
2025-08-23 12:24   ` [REGRESSION][BISECTED][PATCH] " Brett Sheffield
2025-08-25  6:02     ` Oscar Maes
2025-08-25  6:09       ` [PATCH net 1/2] net: ipv4: fix regression in local-broadcast routes Oscar Maes
2025-08-25  6:09         ` [PATCH net 2/2] selftests: net: add test for destination in broadcast packets Oscar Maes
2025-08-25  7:03           ` Brett A C Sheffield
2025-08-25 22:56         ` [PATCH net 1/2] net: ipv4: fix regression in local-broadcast routes Jakub Kicinski
2025-08-26 12:11           ` Oscar Maes
2025-08-26 12:17             ` [PATCH net v2 " Oscar Maes
2025-08-26 12:17             ` [PATCH net v2 2/2] selftests: net: add test for destination in broadcast packets Oscar Maes
2025-08-27  1:29               ` Jakub Kicinski
2025-08-28  8:17 ` [REGRESSION][BISECTED][PATCH] net: ipv4: fix regression in broadcast routes kernel test robot
2025-08-28 10:35   ` Paolo Abeni
2025-08-28 10:46     ` Brett A C Sheffield
2025-08-29  2:08       ` Oliver Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).