Skip to content

Commit 5189446

Browse files
oscar-maesPaolo Abeni
authored andcommitted
net: ipv4: fix regression in local-broadcast routes
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>
1 parent dac978e commit 5189446

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
@@ -2575,12 +2575,16 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
25752575
!netif_is_l3_master(dev_out))
25762576
return ERR_PTR(-EINVAL);
25772577

2578-
if (ipv4_is_lbcast(fl4->daddr))
2578+
if (ipv4_is_lbcast(fl4->daddr)) {
25792579
type = RTN_BROADCAST;
2580-
else if (ipv4_is_multicast(fl4->daddr))
2580+
2581+
/* reset fi to prevent gateway resolution */
2582+
fi = NULL;
2583+
} else if (ipv4_is_multicast(fl4->daddr)) {
25812584
type = RTN_MULTICAST;
2582-
else if (ipv4_is_zeronet(fl4->daddr))
2585+
} else if (ipv4_is_zeronet(fl4->daddr)) {
25832586
return ERR_PTR(-EINVAL);
2587+
}
25842588

25852589
if (dev_out->flags & IFF_LOOPBACK)
25862590
flags |= RTCF_LOCAL;

0 commit comments

Comments
 (0)