Skip to contentSkip to conversation

net: ipv4: fix incorrect MTU in broadcast routes

PATCH Applied Oscar Maes 3 participants 4 messages Jul 10, 2025 – Jul 15, 2025

Subsystems (5)
lore
Share & tools
lore

Oscar Maes

author
#0 lore raw

PATCH v2 1/2 net: ipv4: fix incorrect MTU in broadcast routes

Currently, __mkroute_output overrules the MTU value configured for broadcast routes.

This buggy behaviour can be reproduced with:

ip link set dev eth1 mtu 9000
ip route del broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2 ip route add broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2 mtu 1500

The maximum packet size should be 1500, but it is actually 8000:

ping -b 192.168.0.255 -s 8000

Fix __mkroute_output to allow MTU values to be configured for for broadcast routes (to support a mixed-MTU local-area-network).

---
 net/ipv4/route.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv4/route.c +0 -1
index 64ba377cd..f639a2ae8 100644
@@ -2588,7 +2588,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 	do_cache = true;
 	if (type == RTN_BROADCAST) {
 		flags |= RTCF_BROADCAST | RTCF_LOCAL;
-		fi = NULL;
 	} else if (type == RTN_MULTICAST) {
 		flags |= RTCF_MULTICAST | RTCF_LOCAL;
 		if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
Signature · 1 line
2.39.5
author
#1 lore raw

PATCH v2 2/2 selftests: net: add test for variable PMTU in broadcast routes

Added a test for variable PMTU in broadcast routes.

This test uses iputils' ping and attempts to send a ping between two peers, which should result in a regular echo reply.

This test will fail when the receiving peer does not receive the echo request due to a lack of packet fragmentation.

---
 tools/testing/selftests/net/Makefile          |  1 +
 tools/testing/selftests/net/broadcast_pmtu.sh | 47 +++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100755 tools/testing/selftests/net/broadcast_pmtu.sh
tools/testing/selftests/net/Makefile +1 -0
index 543776596..fc308c68a 100644
@@ -114,6 +114,7 @@ TEST_PROGS += skf_net_off.sh
 TEST_GEN_FILES += skf_net_off
 TEST_GEN_FILES += tfo
 TEST_PROGS += tfo_passive.sh
+TEST_PROGS += broadcast_pmtu.sh
 
 # YNL files, must be before "include ..lib.mk"
 YNL_GEN_FILES := busy_poller netlink-dumps
tools/testing/selftests/net/broadcast_pmtu.sh new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.39.5
#2 lore raw
In reply to Oscar Maes
FYI: kernel test robot notices the stable kernel rule is not satisfied.

Hi,

Thanks for your patch.

FYI: kernel test robot notices the stable kernel rule is not satisfied.

The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

Rule: add the tag "Cc: [email protected]" in the sign-off area to have the patch automatically included in the stable tree.
Subject: [PATCH net-next v2 1/2] net: ipv4: fix incorrect MTU in broadcast routes

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
In reply to Oscar Maes
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Thu, 10 Jul 2025 16:27:13 +0200 you wrote:

Currently, __mkroute_output overrules the MTU value configured for broadcast routes.

This buggy behaviour can be reproduced with:

ip link set dev eth1 mtu 9000
ip route del broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2 ip route add broadcast 192.168.0.255 dev eth1 proto kernel scope link src 192.168.0.2 mtu 1500

[...]

Here is the summary with links:
- [net-next,v2,1/2] net: ipv4: fix incorrect MTU in broadcast routes

    https://git.kernel.org/netdev/net-next/c/9e30ecf23b1b
  - [net-next,v2,2/2] selftests: net: add test for variable PMTU in broadcast routes
    https://git.kernel.org/netdev/net-next/c/5777d1871bf6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html