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: [email protected] Fixes: 9e30ecf ("net: ipv4: fix incorrect MTU in broadcast routes") Reported-by: Brett A C Sheffield <[email protected]> Closes: https://lore.kernel.org/regressions/[email protected] Signed-off-by: Oscar Maes <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
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)