Skip to content

Commit 018afe9

Browse files
oscar-maesgregkh
authored andcommitted
net: ipv4: fix regression in local-broadcast routes
[ Upstream commit 5189446 ] Commit 9e30ecf ("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. This preserves the intended changes for directed-broadcast packets. Cc: stable@vger.kernel.org Fixes: 9e30ecf ("net: ipv4: fix incorrect MTU in broadcast routes") Reported-by: Brett A C Sheffield <bacs@librecast.net> Closes: https://lore.kernel.org/regressions/20250822165231.4353-4-bacs@librecast.net Signed-off-by: Oscar Maes <oscmaes92@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://patch.msgid.link/20250827062322.4807-1-oscmaes92@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6b4abb5 commit 018afe9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/ipv4/route.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,12 +2573,16 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
25732573
!netif_is_l3_master(dev_out))
25742574
return ERR_PTR(-EINVAL);
25752575

2576-
if (ipv4_is_lbcast(fl4->daddr))
2576+
if (ipv4_is_lbcast(fl4->daddr)) {
25772577
type = RTN_BROADCAST;
2578-
else if (ipv4_is_multicast(fl4->daddr))
2578+
2579+
/* reset fi to prevent gateway resolution */
2580+
fi = NULL;
2581+
} else if (ipv4_is_multicast(fl4->daddr)) {
25792582
type = RTN_MULTICAST;
2580-
else if (ipv4_is_zeronet(fl4->daddr))
2583+
} else if (ipv4_is_zeronet(fl4->daddr)) {
25812584
return ERR_PTR(-EINVAL);
2585+
}
25822586

25832587
if (dev_out->flags & IFF_LOOPBACK)
25842588
flags |= RTCF_LOCAL;

0 commit comments

Comments
 (0)