|
| 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