On Mon, Aug 25, 2025 at 03:56:30PM -0700, Jakub Kicinski wrote:
On Mon, 25 Aug 2025 08:09:17 +0200 Oscar Maes wrote:
Commit 9e30ecf23b1b ("net: ipv4: fix incorrect MTU in broadcast routes") introduced a regression where local-broadcast packets would have their gateway set in __mkroute_output, which was caused by fi = NULL being removed.
Fix this by resetting the fib_info for local-broadcast packets.
Meaning that 9e30ecf23b1b would still change behavior for the subnet broadcast address?
Yes. This is OK because subnet broadcast addresses have separate entries in the local fib table.
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f639a2ae881a..98d237e3ec04 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2575,9 +2575,12 @@ static struct rtable *__mkroute_output(const struct fib_result *res, !netif_is_l3_master(dev_out)) return ERR_PTR(-EINVAL);
- if (ipv4_is_lbcast(fl4->daddr))
- if (ipv4_is_lbcast(fl4->daddr)) { type = RTN_BROADCAST;
- else if (ipv4_is_multicast(fl4->daddr))
/* reset fi to prevent gateway resolution */
fi = NULL;
- } else if (ipv4_is_multicast(fl4->daddr)) type = RTN_MULTICAST; else if (ipv4_is_zeronet(fl4->daddr)) return ERR_PTR(-EINVAL);
nit: please add curly braces around all branches of this if / else if / else ladder, per kernel coding style guide. -- pw-bot: cr