Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v5 0/2] ipv6: Cache pmtu for all paths of a multipath route
@ 2026-12-02 18:25 Vladimir Vdovin
  2026-12-02 18:25 ` [PATCH net-next v5 1/2] " Vladimir Vdovin
  2026-12-02 18:25 ` [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests Vladimir Vdovin
  0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Vdovin @ 2026-12-02 18:25 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
	Shuah Khan
  Cc: netdev, linux-kselftest, Vladimir Vdovin

IPv6 counterpart of commit 7d3f3b4367f3 ("net: ipv4: Cache pmtu for
all packet paths if multipath enabled"), a production issue, flows
blackholing behind two ECMP uplinks; the IPv6 side was deferred back
then [1]. The IPv4 part of v4 went separately [2].

Patch 1 caches a Packet Too Big on every path of a multipath route,
patch 2 adds the IPv6 variant of the pmtu.sh multipath test and one
with paths of different MTU. Both fail without patch 1.

v5, after the review of v4 by Ido:
- the paths are walked for every caller, as for IPv4; v4 kept the walk
  to ip6_update_pmtu() so that a tunnel's mtu, pushed on its own dst,
  would not land on the other paths of the inner route, IPv4 lets it
- the looked-up dst is checked as before, a Packet Too Big at or above
  its mtu ends the update
- a blackhole fib6_nh is skipped inside the walk, from the Sashiko
  review of v4: a replace between nexthop_is_blackhole() and the walk
  could land an exception on it
- the IPv4 patch and its test went separately [2]
v4: https://lore.kernel.org/netdev/20261117193141.27004-1-deliran@verdict.gg/

v4, after the Sashiko review of v3:
- ipv4: each path checks the mtu for itself, the early returns on the
  dst are skipped when it was looked up for the Fragmentation Needed;
  a locked mtu goes no higher than what a path uses, a path with a
  locked pmtu is left alone
- ipv6: walk the paths only from ip6_update_pmtu(), where dst comes
  from a lookup; sockets and tunnels update their own dst as before,
  a tunnel mtu no longer lands on the other paths of the inner route
- ipv6: skip a blackhole nexthop and siblings not in the tree
- tests: ping with ICMP sockets, a raw socket handles a Packet Too Big
  a second time and could pass the IPv6 tests without the fix
- tests: the IPv6 addresses on lo are added with nodad, the pings
  through R2 are 1280 bytes to stay below the 1350 link
v3: https://lore.kernel.org/netdev/20261113122237.88990-1-deliran@verdict.gg/

v3, after the Sashiko review of v2:
- compare the mtu with what each path uses now, not once with the
  looked-up dst, so no path gets a pmtu above what it can carry
- ipv6: keep updating a cached dst itself, the walk may not find it
- ipv4: Fixes: tag, Fragmentation Needed wording
- tests: MTU 1350 on the link to R2, so a Packet Too Big from R1 must
  not be cached on the path via R2
- tests: return routes on R1 and R2, hex flow labels, skip when
  "ip route get" has no flowlabel
v2: https://lore.kernel.org/netdev/20261110095903.84813-1-deliran@verdict.gg/

v2, after the Sashiko review of v1:
- update an existing exception in place, on every Packet Too Big
- don't walk the siblings of a fib6_info no longer in the tree
- commit message: the lookup in ip6_update_pmtu() hashes without
  protocol and ports
- new ipv4 patch, tests with paths of different MTU
v1: https://lore.kernel.org/netdev/20261017210508.71849-1-deliran@verdict.gg/

[1] https://lore.kernel.org/netdev/ad29493c-9e48-4a94-b327-e47af3a9d137@kernel.org/
[2] https://lore.kernel.org/netdev/20261124153730.56549-1-deliran@verdict.gg/

Vladimir Vdovin (2):
  ipv6: Cache pmtu for all paths of a multipath route
  selftests: net: pmtu: Add IPv6 multipath tests

 net/ipv6/route.c                    | 122 ++++++++++----
 tools/testing/selftests/net/pmtu.sh | 253 +++++++++++++++++++++-------
 2 files changed, 281 insertions(+), 94 deletions(-)


base-commit: 41055751bb7b27c1317c679a9252baeebc4aa638
-- 
2.56.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next v5 1/2] ipv6: Cache pmtu for all paths of a multipath route
  2026-12-02 18:25 [PATCH net-next v5 0/2] ipv6: Cache pmtu for all paths of a multipath route Vladimir Vdovin
@ 2026-12-02 18:25 ` Vladimir Vdovin
  2026-12-03 19:01   ` netdev-bot+sashiko
  2026-12-02 18:25 ` [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests Vladimir Vdovin
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Vdovin @ 2026-12-02 18:25 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
	Shuah Khan
  Cc: netdev, linux-kselftest, Vladimir Vdovin

When IPv6 receives a Packet Too Big, the route lookup can select a
different nexthop from the one the original packet used. The lookup can
be constrained by the incoming interface. For an unbound socket, the
lookup can hash the flow without its protocol or ports. If the exception
lands on the wrong path, the sender keeps using the old PMTU and
oversized packets continue to be dropped.

Update the PMTU on each path of the multipath route, as IPv4 does since
commit 7d3f3b4367f3 ("net: ipv4: Cache pmtu for all packet paths if
multipath enabled"). Compare the reported MTU with the MTU in use on
each path. If it is lower, update the existing exception in place to
preserve any gateway learned from a redirect, or create an exception if
none exists. One Packet Too Big can thus create up to one exception per
path.

For legacy multipath routes, skip siblings that are no longer in the
FIB. For routes that use nexthop objects, check for a blackhole as each
nexthop is visited. A concurrent replacement can install a blackhole
after the route lookup.

Link: https://lore.kernel.org/netdev/ad29493c-9e48-4a94-b327-e47af3a9d137@kernel.org/
Signed-off-by: Vladimir Vdovin <deliran@verdict.gg>
---
 net/ipv6/route.c | 122 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 87 insertions(+), 35 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index df843178e5ec..cd3672287afe 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2917,12 +2917,63 @@ static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)
 		(rt->rt6i_flags & RTF_PCPU || rcu_access_pointer(rt->from));
 }
 
+struct rt6_pmtu_arg {
+	struct fib6_result	res;
+	const struct in6_addr	*daddr;
+	const struct in6_addr	*saddr;
+	u32			mtu;
+};
+
+static int rt6_nh_update_pmtu(struct fib6_nh *nh, void *_arg)
+{
+	struct rt6_pmtu_arg *arg = _arg;
+	struct fib6_result *res = &arg->res;
+	struct rt6_info *rt;
+
+	res->nh = nh;
+	rt = rt6_find_cached_rt(res, arg->daddr, arg->saddr);
+	if (rt) {
+		/* Keep any gateway learned from a redirect. */
+		if (arg->mtu < dst6_mtu(&rt->dst)) {
+			rt6_do_update_pmtu(rt, arg->mtu);
+			fib6_nh_update_exception(nh, res->f6i->fib6_src.plen,
+						 rt);
+		}
+		return 0;
+	}
+
+	if (arg->mtu >= fib6_mtu(res))
+		return 0;
+
+	rt = ip6_rt_cache_alloc(res, arg->daddr, arg->saddr);
+	if (rt) {
+		rt6_do_update_pmtu(rt, arg->mtu);
+		if (rt6_insert_exception(rt, res))
+			dst_release_immediate(&rt->dst);
+	}
+
+	return 0;
+}
+
+/* A concurrent replace can install a blackhole after the route lookup.
+ * Check the nh_info supplied by the iterator before caching an exception.
+ */
+static int rt6_nexthop_update_pmtu(struct fib6_nh *nh, void *_arg)
+{
+	if (container_of(nh, struct nh_info, fib6_nh)->reject_nh)
+		return 0;
+
+	return rt6_nh_update_pmtu(nh, _arg);
+}
+
 static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 				 const struct ipv6hdr *iph, u32 mtu,
 				 bool confirm_neigh)
 {
-	const struct in6_addr *daddr, *saddr;
+	struct rt6_pmtu_arg arg = { .mtu = mtu };
 	struct rt6_info *rt6 = dst_rt6_info(dst);
+	const struct in6_addr *daddr, *saddr;
+	struct fib6_info *f6i, *sibling;
 
 	/* Note: do *NOT* check dst_metric_locked(dst, RTAX_MTU)
 	 * IPv6 pmtu discovery isn't optional, so 'mtu lock' cannot disable it.
@@ -2945,6 +2996,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 
 	if (mtu < IPV6_MIN_MTU)
 		return;
+
 	if (mtu >= dst6_mtu(dst))
 		return;
 
@@ -2953,47 +3005,47 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
 		/* update rt6_ex->stamp for cache */
 		if (rt6->rt6i_flags & RTF_CACHE)
 			rt6_update_exception_stamp_rt(rt6);
-	} else if (daddr) {
-		struct fib6_result res = {};
-		struct rt6_info *nrt6;
-
-		rcu_read_lock();
-		res.f6i = rcu_dereference(rt6->from);
-		if (!res.f6i)
-			goto out_unlock;
+	}
 
-		res.fib6_flags = res.f6i->fib6_flags;
-		res.fib6_type = res.f6i->fib6_type;
+	/* The PTB lookup can select a different path from the original flow. */
+	if (!daddr)
+		return;
 
-		if (res.f6i->nh) {
-			struct fib6_nh_match_arg arg = {
-				.dev = dst_dev_rcu(dst),
-				.gw = &rt6->rt6i_gateway,
-			};
+	rcu_read_lock();
+	f6i = rcu_dereference(rt6->from);
+	/* A route on its way out of the tree takes no exceptions */
+	if (!f6i || !rcu_access_pointer(f6i->fib6_node))
+		goto out;
 
-			nexthop_for_each_fib6_nh(res.f6i->nh,
-						 fib6_nh_find_match, &arg);
+	arg.daddr = daddr;
+	arg.saddr = saddr;
+	arg.res.f6i = f6i;
+	arg.res.fib6_flags = f6i->fib6_flags;
+	arg.res.fib6_type = f6i->fib6_type;
 
-			/* fib6_info uses a nexthop that does not have fib6_nh
-			 * using the dst->dev + gw. Should be impossible.
-			 */
-			if (!arg.match)
-				goto out_unlock;
+	if (f6i->nh) {
+		nexthop_for_each_fib6_nh(f6i->nh, rt6_nexthop_update_pmtu,
+					 &arg);
+		goto out;
+	}
 
-			res.nh = arg.match;
-		} else {
-			res.nh = res.f6i->fib6_nh;
-		}
+	rt6_nh_update_pmtu(f6i->fib6_nh, &arg);
 
-		nrt6 = ip6_rt_cache_alloc(&res, daddr, saddr);
-		if (nrt6) {
-			rt6_do_update_pmtu(nrt6, mtu);
-			if (rt6_insert_exception(nrt6, &res))
-				dst_release_immediate(&nrt6->dst);
-		}
-out_unlock:
-		rcu_read_unlock();
+	/* Stop when f6i leaves the sibling list, the walk would never end.
+	 * Skip a sibling not in the tree, being added or removed.
+	 */
+	list_for_each_entry_rcu(sibling, &f6i->fib6_siblings, fib6_siblings) {
+		if (!READ_ONCE(f6i->fib6_nsiblings))
+			break;
+		if (!rcu_access_pointer(sibling->fib6_node))
+			continue;
+		arg.res.f6i = sibling;
+		arg.res.fib6_flags = sibling->fib6_flags;
+		arg.res.fib6_type = sibling->fib6_type;
+		rt6_nh_update_pmtu(sibling->fib6_nh, &arg);
 	}
+out:
+	rcu_read_unlock();
 }
 
 static void ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests
  2026-12-02 18:25 [PATCH net-next v5 0/2] ipv6: Cache pmtu for all paths of a multipath route Vladimir Vdovin
  2026-12-02 18:25 ` [PATCH net-next v5 1/2] " Vladimir Vdovin
@ 2026-12-02 18:25 ` Vladimir Vdovin
  2026-12-03 19:01   ` netdev-bot+sashiko
  1 sibling, 1 reply; 5+ messages in thread
From: Vladimir Vdovin @ 2026-12-02 18:25 UTC (permalink / raw)
  To: David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
	Shuah Khan
  Cc: netdev, linux-kselftest, Vladimir Vdovin

Share the IPv4 multipath PMTU tests with IPv6. With an MTU of 1500
behind both routers, check that one oversized ping creates a PMTU
exception of 1500 on both paths.

For the asymmetric case, use IPv6 flow labels to send one ping through
each router. R1 reports an MTU of 1400. Only the path through R1 should
cache that value because the link from the host to R2 has an MTU of
1350. R2 then reports an MTU of 1300, which both paths should cache.

Use ICMP datagram sockets for ping. With a raw socket, rawv6_err() can
process the same Packet Too Big a second time. Its lookup can select the
other path and make the test pass without the fix.

Without the preceding fix, both IPv6 tests fail with legacy nexthops and
with nexthop objects.

Signed-off-by: Vladimir Vdovin <deliran@verdict.gg>
---
 tools/testing/selftests/net/pmtu.sh | 253 +++++++++++++++++++++-------
 1 file changed, 194 insertions(+), 59 deletions(-)

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index a5d602a453c9..9403e87ee608 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -204,12 +204,18 @@
 #	addresses have multipath routes to each other, b_r1 mtu = 1500.
 #	Check that PMTU exceptions are created for both paths.
 #
+# - pmtu_ipv6_mp_exceptions
+#	Same as above but with IPv6
+#
 # - pmtu_ipv4_mp_asym_exceptions
 #	Same topology as pmtu_ipv4_mp_exceptions, with b_r1 mtu = 1400,
 #	a_r2 mtu = 1350 and b_r2 mtu = 1300. Pick a flow through each router
 #	and check that a Fragmentation Needed from R1 creates a PMTU
 #	exception on the path via R1 only, as the path via R2 can't carry
 #	1400, then that a flow through R2 lowers the PMTU of both paths
+#
+# - pmtu_ipv6_mp_asym_exceptions
+#	Same as above but with IPv6
 
 source lib.sh
 
@@ -280,7 +286,9 @@ tests="
 	pmtu_ipv4_route_change		ipv4: PMTU exception w/route replace	1
 	pmtu_ipv6_route_change		ipv6: PMTU exception w/route replace	1
 	pmtu_ipv4_mp_exceptions		ipv4: PMTU multipath nh exceptions	1
-	pmtu_ipv4_mp_asym_exceptions	ipv4: PMTU multipath exceptions, asym MTU	1"
+	pmtu_ipv6_mp_exceptions		ipv6: PMTU multipath nh exceptions	1
+	pmtu_ipv4_mp_asym_exceptions	ipv4: PMTU multipath exceptions, asym MTU	1
+	pmtu_ipv6_mp_asym_exceptions	ipv6: PMTU multipath exceptions, asym MTU	1"
 
 # Addressing and routing for tests with routers: four network segments, with
 # index SEGMENT between 1 and 4, a common prefix (PREFIX4 or PREFIX6) and an
@@ -361,6 +369,9 @@ host4_a_addr="192.168.99.99"
 host4_a_net="192.168.97"
 host4_b_addr="192.168.88.88"
 
+host6_a_addr="fc00:1000::a"
+host6_b_addr="fc00:1001::b"
+
 dummy6_0_prefix="fc00:1000::"
 dummy6_1_prefix="fc00:1001::"
 dummy6_mask="64"
@@ -1003,49 +1014,119 @@ setup_ovs_bridge() {
 }
 
 setup_multipath_new() {
-	# Set up host A with multipath routes to host B host4_b_addr
-	run_cmd ${ns_a} ip addr add ${host4_a_addr} dev lo
-	run_cmd ${ns_a} ip nexthop add id 401 via ${prefix4}.${a_r1}.2 dev veth_A-R1
-	run_cmd ${ns_a} ip nexthop add id 402 via ${prefix4}.${a_r2}.2 dev veth_A-R2
-	run_cmd ${ns_a} ip nexthop add id 403 group 401/402
-	run_cmd ${ns_a} ip route add ${host4_b_addr} src ${host4_a_addr} nhid 403
+	family=${1}
 
-	# Set up host B with multipath routes to host A host4_a_addr
-	run_cmd ${ns_b} ip addr add ${host4_b_addr} dev lo
-	run_cmd ${ns_b} ip nexthop add id 401 via ${prefix4}.${b_r1}.2 dev veth_B-R1
-	run_cmd ${ns_b} ip nexthop add id 402 via ${prefix4}.${b_r2}.2 dev veth_B-R2
-	run_cmd ${ns_b} ip nexthop add id 403 group 401/402
-	run_cmd ${ns_b} ip route add ${host4_a_addr} src ${host4_b_addr} nhid 403
+	if [ ${family} -eq 4 ]; then
+		host_a_addr=${host4_a_addr}
+		host_b_addr=${host4_b_addr}
+		nodad=""
+		nh_a_r1=${prefix4}.${a_r1}.2
+		nh_a_r2=${prefix4}.${a_r2}.2
+		nh_b_r1=${prefix4}.${b_r1}.2
+		nh_b_r2=${prefix4}.${b_r2}.2
+	else
+		host_a_addr=${host6_a_addr}
+		host_b_addr=${host6_b_addr}
+		nodad="nodad"
+		nh_a_r1=${prefix6}:${a_r1}::2
+		nh_a_r2=${prefix6}:${a_r2}::2
+		nh_b_r1=${prefix6}:${b_r1}::2
+		nh_b_r2=${prefix6}:${b_r2}::2
+	fi
+
+	# Set up host A with multipath routes to host B host_b_addr
+	run_cmd ${ns_a} ip addr add ${host_a_addr} dev lo ${nodad}
+	run_cmd ${ns_a} ip nexthop add id ${family}01 via ${nh_a_r1} dev veth_A-R1
+	run_cmd ${ns_a} ip nexthop add id ${family}02 via ${nh_a_r2} dev veth_A-R2
+	run_cmd ${ns_a} ip nexthop add id ${family}03 group ${family}01/${family}02
+	run_cmd ${ns_a} ip route add ${host_b_addr} src ${host_a_addr} nhid ${family}03
+
+	# Set up host B with multipath routes to host A host_a_addr
+	run_cmd ${ns_b} ip addr add ${host_b_addr} dev lo ${nodad}
+	run_cmd ${ns_b} ip nexthop add id ${family}01 via ${nh_b_r1} dev veth_B-R1
+	run_cmd ${ns_b} ip nexthop add id ${family}02 via ${nh_b_r2} dev veth_B-R2
+	run_cmd ${ns_b} ip nexthop add id ${family}03 group ${family}01/${family}02
+	run_cmd ${ns_b} ip route add ${host_a_addr} src ${host_b_addr} nhid ${family}03
 }
 
 setup_multipath_old() {
-	# Set up host A with multipath routes to host B host4_b_addr
-	run_cmd ${ns_a} ip addr add ${host4_a_addr} dev lo
-	run_cmd ${ns_a} ip route add ${host4_b_addr} \
-			src ${host4_a_addr} \
-			nexthop via ${prefix4}.${a_r1}.2 weight 1 \
-			nexthop via ${prefix4}.${a_r2}.2 weight 1
+	family=${1}
+
+	if [ ${family} -eq 4 ]; then
+		host_a_addr=${host4_a_addr}
+		host_b_addr=${host4_b_addr}
+		nodad=""
+		nh_a_r1=${prefix4}.${a_r1}.2
+		nh_a_r2=${prefix4}.${a_r2}.2
+		nh_b_r1=${prefix4}.${b_r1}.2
+		nh_b_r2=${prefix4}.${b_r2}.2
+	else
+		host_a_addr=${host6_a_addr}
+		host_b_addr=${host6_b_addr}
+		nodad="nodad"
+		nh_a_r1=${prefix6}:${a_r1}::2
+		nh_a_r2=${prefix6}:${a_r2}::2
+		nh_b_r1=${prefix6}:${b_r1}::2
+		nh_b_r2=${prefix6}:${b_r2}::2
+	fi
+
+	# Set up host A with multipath routes to host B host_b_addr
+	run_cmd ${ns_a} ip addr add ${host_a_addr} dev lo ${nodad}
+	run_cmd ${ns_a} ip route add ${host_b_addr} \
+			src ${host_a_addr} \
+			nexthop via ${nh_a_r1} weight 1 \
+			nexthop via ${nh_a_r2} weight 1
 
-	# Set up host B with multipath routes to host A host4_a_addr
-	run_cmd ${ns_b} ip addr add ${host4_b_addr} dev lo
-	run_cmd ${ns_b} ip route add ${host4_a_addr} \
-			src ${host4_b_addr} \
-			nexthop via ${prefix4}.${b_r1}.2 weight 1 \
-			nexthop via ${prefix4}.${b_r2}.2 weight 1
+	# Set up host B with multipath routes to host A host_a_addr
+	run_cmd ${ns_b} ip addr add ${host_b_addr} dev lo ${nodad}
+	run_cmd ${ns_b} ip route add ${host_a_addr} \
+			src ${host_b_addr} \
+			nexthop via ${nh_b_r1} weight 1 \
+			nexthop via ${nh_b_r2} weight 1
 }
 
+
 setup_multipath() {
+	family="$1"
+
+	if [ ${family} -eq 4 ]; then
+		host_a_addr=${host4_a_addr}
+		host_b_addr=${host4_b_addr}
+		nh_r1_a=${prefix4}.${a_r1}.1
+		nh_r1_b=${prefix4}.${b_r1}.1
+		nh_r2_a=${prefix4}.${a_r2}.1
+		nh_r2_b=${prefix4}.${b_r2}.1
+	else
+		host_a_addr=${host6_a_addr}
+		host_b_addr=${host6_b_addr}
+		nh_r1_a=${prefix6}:${a_r1}::1
+		nh_r1_b=${prefix6}:${b_r1}::1
+		nh_r2_a=${prefix6}:${a_r2}::1
+		nh_r2_b=${prefix6}:${b_r2}::1
+	fi
+
 	if [ "$USE_NH" = "yes" ]; then
-		setup_multipath_new
+		setup_multipath_new ${family}
 	else
-		setup_multipath_old
+		setup_multipath_old ${family}
 	fi
 
 	# Set up routers with routes to dummies
-	run_cmd ${ns_r1} ip route add ${host4_a_addr} via ${prefix4}.${a_r1}.1
-	run_cmd ${ns_r2} ip route add ${host4_a_addr} via ${prefix4}.${a_r2}.1
-	run_cmd ${ns_r1} ip route add ${host4_b_addr} via ${prefix4}.${b_r1}.1
-	run_cmd ${ns_r2} ip route add ${host4_b_addr} via ${prefix4}.${b_r2}.1
+	run_cmd ${ns_r1} ip route add ${host_a_addr} via ${nh_r1_a}
+	run_cmd ${ns_r2} ip route add ${host_a_addr} via ${nh_r2_a}
+	run_cmd ${ns_r1} ip route add ${host_b_addr} via ${nh_r1_b}
+	run_cmd ${ns_r2} ip route add ${host_b_addr} via ${nh_r2_b}
+
+	# Let ping use ICMPv6 datagram sockets to avoid handling a PTB twice.
+	${ns_a} sysctl -q -w net.ipv4.ping_group_range="0 2147483647"
+}
+
+setup_multipath4() {
+	setup_multipath 4
+}
+
+setup_multipath6() {
+	setup_multipath 6
 }
 
 setup() {
@@ -2386,8 +2467,18 @@ test_pmtu_ipv6_route_change() {
 	test_pmtu_ipvX_route_change 6
 }
 
-test_pmtu_ipv4_mp_exceptions() {
-	setup namespaces routing multipath || return $ksft_skip
+test_pmtu_ipvX_mp_exceptions() {
+	family=${1}
+
+	if [ ${family} -eq 4 ]; then
+		ping=ping
+		dst="${host4_b_addr}"
+	else
+		ping=${ping6}
+		dst="${host6_b_addr}"
+	fi
+
+	setup namespaces routing multipath${family} || return $ksft_skip
 
 	trace "${ns_a}"  veth_A-R1    "${ns_r1}" veth_R1-A \
 	      "${ns_r1}" veth_R1-B    "${ns_b}"  veth_B-R1 \
@@ -2406,44 +2497,69 @@ test_pmtu_ipv4_mp_exceptions() {
 	mtu "${ns_b}"  veth_B-R2 1500
 
 	# Ping and expect two nexthop exceptions for two routes
-	run_cmd ${ns_a} ping -q -M want -i 0.1 -c 1 -s 1800 "${host4_b_addr}"
+	run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -c 1 -s 1800 "${dst}"
 
 	# Check that exceptions have been created with the correct PMTU
-	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R1)"
-	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R2)"
+	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R1)"
+	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R2)"
 
 	check_pmtu_value "1500" "${pmtu_a_R1}" "exceeding MTU (veth_A-R1)" || return 1
 	check_pmtu_value "1500" "${pmtu_a_R2}" "exceeding MTU (veth_A-R2)" || return 1
 }
 
-# Pick a source address out of ${host4_a_net} for a flow from host A to
-# ${1} through ${2}: the IPv4 multipath hash covers addresses only by
-# default
+test_pmtu_ipv4_mp_exceptions() {
+	test_pmtu_ipvX_mp_exceptions 4
+}
+
+# Pick an IPv4 source address or an IPv6 flow label for a flow from host A
+# to ${2} through ${3}. Both ip and ping take the flow label in hex.
 mp_flow_via() {
-	dst="${1}"
-	oif="${2}"
+	family="${1}"
+	dst="${2}"
+	oif="${3}"
 
 	for i in $(seq 1 32); do
-		flow="${host4_a_net}.${i}"
-		${ns_a} ip route get ${dst} from ${flow} |
+		if [ ${family} -eq 4 ]; then
+			flow="${host4_a_net}.${i}"
+			lookup="from ${flow}"
+		else
+			flow="$(printf "0x%x" ${i})"
+			lookup="from ${host6_a_addr} ipproto 58 flowlabel ${flow}"
+		fi
+		${ns_a} ip route get ${dst} ${lookup} |
 			grep -q " dev ${oif} " && echo "${flow}" && return
 	done
 
 	return 1
 }
 
-test_pmtu_ipv4_mp_asym_exceptions() {
-	setup namespaces routing multipath || return $ksft_skip
+test_pmtu_ipvX_mp_asym_exceptions() {
+	family=${1}
+
+	if [ ${family} -eq 4 ]; then
+		ping=ping
+		dst="${host4_b_addr}"
+	else
+		ping=${ping6}
+		dst="${host6_b_addr}"
+	fi
+
+	setup namespaces routing multipath${family} || return $ksft_skip
 
 	trace "${ns_a}"  veth_A-R1    "${ns_r1}" veth_R1-A \
 	      "${ns_r1}" veth_R1-B    "${ns_b}"  veth_B-R1 \
 	      "${ns_a}"  veth_A-R2    "${ns_r2}" veth_R2-A \
 	      "${ns_r2}" veth_R2-B    "${ns_b}"  veth_B-R2
 
-	# Source addresses for mp_flow_via(), with routes back to them
-	run_cmd ${ns_a} ip route add local ${host4_a_net}.0/24 dev lo
-	run_cmd ${ns_r1} ip route add ${host4_a_net}.0/24 via ${prefix4}.${a_r1}.1
-	run_cmd ${ns_r2} ip route add ${host4_a_net}.0/24 via ${prefix4}.${a_r2}.1
+	if [ ${family} -eq 4 ]; then
+		# Source addresses for mp_flow_via(), with routes back to them
+		run_cmd ${ns_a} ip route add local ${host4_a_net}.0/24 dev lo
+		run_cmd ${ns_r1} ip route add ${host4_a_net}.0/24 via ${prefix4}.${a_r1}.1
+		run_cmd ${ns_r2} ip route add ${host4_a_net}.0/24 via ${prefix4}.${a_r2}.1
+	else
+		${ns_a} ip route get ${dst} ipproto 58 flowlabel 0x1 >/dev/null 2>&1 || {
+			err "  ip route get flowlabel not supported"; return $ksft_skip; }
+	fi
 
 	# Set up initial MTU values: 1400 behind R1, 1350 to R2, 1300 behind R2
 	mtu "${ns_a}"  veth_A-R1 2000
@@ -2456,29 +2572,48 @@ test_pmtu_ipv4_mp_asym_exceptions() {
 	mtu "${ns_r2}" veth_R2-B 1300
 	mtu "${ns_b}"  veth_B-R2 1300
 
-	flow_r1="$(mp_flow_via ${host4_b_addr} veth_A-R1)" || {
+	flow_r1="$(mp_flow_via ${family} ${dst} veth_A-R1)" || {
 		err "  no flow through veth_A-R1 found"; return 1; }
-	flow_r2="$(mp_flow_via ${host4_b_addr} veth_A-R2)" || {
+	flow_r2="$(mp_flow_via ${family} ${dst} veth_A-R2)" || {
 		err "  no flow through veth_A-R2 found"; return 1; }
+	if [ ${family} -eq 4 ]; then
+		ping_r1="${ping} -I ${flow_r1}"
+		ping_r2="${ping} -I ${flow_r2}"
+	else
+		ping_r1="${ping} -I ${host6_a_addr} -F ${flow_r1}"
+		ping_r2="${ping} -I ${host6_a_addr} -F ${flow_r2}"
+	fi
 
-	# A Fragmentation Needed from R1 is cached on the path via R1, not on
-	# the path via R2, whose link can't carry 1400
-	run_cmd ${ns_a} ping -I ${flow_r1} -q -M want -i 0.1 -c 1 -s 1800 "${host4_b_addr}"
+	# The error from R1 is cached on the path via R1, not on the path via
+	# R2, whose link can't carry 1400
+	run_cmd ${ns_a} ${ping_r1} -q -M want -i 0.1 -c 1 -s 1800 "${dst}"
 
-	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R1)"
-	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R2)"
+	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R1)"
+	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R2)"
 	check_pmtu_value "1400" "${pmtu_a_R1}" "exceeding MTU via R1 (veth_A-R1)" || return 1
 	check_pmtu_value "" "${pmtu_a_R2}" "exceeding MTU via R1 (veth_A-R2)" || return 1
 
 	# The lower MTU behind R2 lowers the PMTU of both paths
-	run_cmd ${ns_a} ping -I ${flow_r2} -q -M want -i 0.1 -c 1 -s 1280 "${host4_b_addr}"
+	run_cmd ${ns_a} ${ping_r2} -q -M want -i 0.1 -c 1 -s 1280 "${dst}"
 
-	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R1)"
-	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R2)"
+	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R1)"
+	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R2)"
 	check_pmtu_value "1300" "${pmtu_a_R1}" "exceeding MTU via R2 (veth_A-R1)" || return 1
 	check_pmtu_value "1300" "${pmtu_a_R2}" "exceeding MTU via R2 (veth_A-R2)" || return 1
 }
 
+test_pmtu_ipv4_mp_asym_exceptions() {
+	test_pmtu_ipvX_mp_asym_exceptions 4
+}
+
+test_pmtu_ipv6_mp_asym_exceptions() {
+	test_pmtu_ipvX_mp_asym_exceptions 6
+}
+
+test_pmtu_ipv6_mp_exceptions() {
+	test_pmtu_ipvX_mp_exceptions 6
+}
+
 usage() {
 	echo
 	echo "$0 [OPTIONS] [TEST]..."
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v5 1/2] ipv6: Cache pmtu for all paths of a multipath route
  2026-12-02 18:25 ` [PATCH net-next v5 1/2] " Vladimir Vdovin
@ 2026-12-03 19:01   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 19:01 UTC (permalink / raw)
  To: deliran
  Cc: dsahern, idosch, davem, edumazet, kuba, pabeni, willemb, horms,
	shuah, netdev, linux-kselftest

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The new walk over every path of a multipath route in
  __ip6_rt_update_pmtu() (net/ipv6/route.c) still sits behind the…
- [Medium] rt6_nh_update_pmtu() adds a check-then-write on exception
  routes that holds no lock.

--

ipv6: Cache pmtu for all paths of a multipath route

When a Packet Too Big is received, __ip6_rt_update_pmtu() now walks
every path of a multipath route. This covers both legacy siblings and
nexthop objects. On each path it updates an existing exception in place,
or creates one if the reported MTU is lower than that path's MTU,
following what IPv4 does since commit 7d3f3b4367f3.

Link: https://lore.kernel.org/netdev/ad29493c-9e48-4a94-b327-e47af3a9d137@kernel.org/

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index df843178e5ecc..cd3672287afed 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2917,12 +2917,63 @@ static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)

[ ... ]

> +static int rt6_nh_update_pmtu(struct fib6_nh *nh, void *_arg)
> +{
> +	struct rt6_pmtu_arg *arg = _arg;
> +	struct fib6_result *res = &arg->res;
> +	struct rt6_info *rt;
> +
> +	res->nh = nh;
> +	rt = rt6_find_cached_rt(res, arg->daddr, arg->saddr);
> +	if (rt) {
> +		/* Keep any gateway learned from a redirect. */
> +		if (arg->mtu < dst6_mtu(&rt->dst)) {
> +			rt6_do_update_pmtu(rt, arg->mtu);

[Severity: Medium]
Can this in-place update race with a device MTU decrease?

The check and the write here run under RCU only. There is no
rt6_exception_lock and no re-check against fib6_mtu(res). The device MTU
change path writes the same metric under the lock:

rt6_mtu_change()->fib6_nh_mtu_change()->rt6_exceptions_update_pmtu() {
    ...
			if (dst_metric_raw(&entry->dst, RTAX_MTU) &&
			    rt6_mtu_change_route_allowed(idev, entry, mtu))
				dst_metric_set(&entry->dst, RTAX_MTU, mtu);
    ...
}

rt6_insert_exception() re-checks under the lock for this exact reason:

	/* rt6_mtu_change() might lower mtu on f6i.
	 * Only insert this exception route if its mtu
	 * is less than f6i's mtu value.
	 */
	if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) {

A possible interleaving:

CPU0 (softirq, PTB mtu=1400)
rt6_nh_update_pmtu()
    arg->mtu (1400) < dst6_mtu(&rt->dst) (1500)

CPU1 (NETDEV_CHANGEMTU to 1300)
rt6_exceptions_update_pmtu()
    dst_metric_set(&entry->dst, RTAX_MTU, 1300)

CPU0
rt6_do_update_pmtu(rt, 1400)
    dst_metric_set(&rt->dst, RTAX_MTU, 1400)

ip6_dst_mtu_maybe_forward() returns the raw metric without clamping it to
the device MTU. The exception would then report 1400 on a 1300 MTU
device until it expires (ip6_rt_mtu_expires, 600s by default).

The RTF_CACHE branch for the selected dst in __ip6_rt_update_pmtu()
already had this unlocked pattern. This patch adds a new instance that
applies to the exceptions on every path.

Should the in-place update take rt6_exception_lock and re-check
fib6_mtu(), as rt6_insert_exception() does?

> +			fib6_nh_update_exception(nh, res->f6i->fib6_src.plen,
> +						 rt);
> +		}
> +		return 0;
> +	}
> +
> +	if (arg->mtu >= fib6_mtu(res))
> +		return 0;

[ ... ]

> @@ -2945,6 +2996,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
>  
>  	if (mtu < IPV6_MIN_MTU)
>  		return;
> +
>  	if (mtu >= dst6_mtu(dst))
>  		return;

[Severity: High]
Does this early return still block the per-path walk in the case the
commit message describes?

This check only compares against the MTU of the dst that the PTB lookup
selected. ip6_update_pmtu() builds that lookup without protocol or
ports:

	struct flowi6 fl6 = {
		.flowi6_oif = oif,
		.flowi6_mark = mark ? mark : IP6_REPLY_MARK(net, skb->mark),
		.daddr = iph->daddr,
		.saddr = iph->saddr,
		.flowlabel = ip6_flowinfo(iph),
		.flowi6_uid = uid,
	};

	dst = ip6_route_output(net, NULL, &fl6);

So the lookup can select path A while the flow actually uses path B.

Path A may already have an MTU at or below the reported value. It may
have a smaller link MTU, or it may still hold a lower exception after
B's was flushed or evicted. In either case __ip6_rt_update_pmtu() returns
here, before rcu_read_lock(), and never reaches the nexthop or sibling
walk.

For example, path A has link MTU 1400 and path B has 1500. The flow is
hashed to B, and a router on B reports 1450. The lookup selects A, the
check 1450 >= 1400 returns, and B keeps a PMTU of 1500. Oversized
packets on B continue to be dropped.

rt6_nh_update_pmtu() already makes its own per-path comparison:

	if (arg->mtu >= fib6_mtu(res))
		return 0;

Could this check gate only the in-place update of rt6, and let the walk
run either way?

IPv4's __ip_rt_update_pmtu() has a similar old_mtu < mtu gate. However,
the commit message here says "Compare the reported MTU with the MTU in
use on each path".

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202182545.19656-1-deliran%40verdict.gg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests
  2026-12-02 18:25 ` [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests Vladimir Vdovin
@ 2026-12-03 19:01   ` netdev-bot+sashiko
  0 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sashiko @ 2026-12-03 19:01 UTC (permalink / raw)
  To: deliran
  Cc: dsahern, idosch, davem, edumazet, kuba, pabeni, willemb, horms,
	shuah, netdev, linux-kselftest

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] ipv6: early return in __ip6_rt_update_pmtu() skips multipath
  nexthops
- [Low] In tools/testing/selftests/net/pmtu.sh, setup_multipath() now
  writes `net.ipv4.ping_group_range="0 2147483647"` in ns_a for every…

--

selftests: net: pmtu: Add IPv6 multipath tests

This commit extends the IPv4 multipath PMTU selftests in pmtu.sh to IPv6.
It adds pmtu_ipv6_mp_exceptions and pmtu_ipv6_mp_asym_exceptions, and the
asymmetric test uses IPv6 flow labels to send one ping through each
router. It also enables ICMP datagram sockets for ping in ns_a, so that
rawv6_err() does not process the same Packet Too Big twice.

> diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
> index a5d602a453c9b..9403e87ee608f 100755
> --- a/tools/testing/selftests/net/pmtu.sh
> +++ b/tools/testing/selftests/net/pmtu.sh

[ ... ]

> @@ -1003,49 +1014,119 @@ setup_ovs_bridge() {

[ ... ]

>  setup_multipath() {
> +	family="$1"
> +

[ ... ]

>  	# Set up routers with routes to dummies
> -	run_cmd ${ns_r1} ip route add ${host4_a_addr} via ${prefix4}.${a_r1}.1
> -	run_cmd ${ns_r2} ip route add ${host4_a_addr} via ${prefix4}.${a_r2}.1
> -	run_cmd ${ns_r1} ip route add ${host4_b_addr} via ${prefix4}.${b_r1}.1
> -	run_cmd ${ns_r2} ip route add ${host4_b_addr} via ${prefix4}.${b_r2}.1
> +	run_cmd ${ns_r1} ip route add ${host_a_addr} via ${nh_r1_a}
> +	run_cmd ${ns_r2} ip route add ${host_a_addr} via ${nh_r2_a}
> +	run_cmd ${ns_r1} ip route add ${host_b_addr} via ${nh_r1_b}
> +	run_cmd ${ns_r2} ip route add ${host_b_addr} via ${nh_r2_b}
> +
> +	# Let ping use ICMPv6 datagram sockets to avoid handling a PTB twice.
> +	${ns_a} sysctl -q -w net.ipv4.ping_group_range="0 2147483647"
> +}
> +
> +setup_multipath4() {
> +	setup_multipath 4
> +}

[Severity: Low]
Is it intended that this sysctl runs for both families? The comment above
it only mentions ICMPv6.

net.ipv4.ping_group_range is the only range that net/ipv4/ping.c checks,
for both AF_INET and AF_INET6 ping sockets. setup_multipath4() also goes
through setup_multipath(). That means pmtu_ipv4_mp_exceptions and
pmtu_ipv4_mp_asym_exceptions now use ICMP datagram sockets as well.

Before this patch, the netns default range of "1 0" denied datagram
sockets, so ping fell back to SOCK_RAW. IPv4 Fragmentation Needed handling
now goes through ping_err() instead of raw_err(). Both call
ipv4_sk_update_pmtu(), so IPv4 coverage should stay about the same.

The commit message describes the change as IPv6 only:

  Use ICMP datagram sockets for ping. With a raw socket, rawv6_err() can
  process the same Packet Too Big a second time.

Could the sysctl be set only when family is 6? Alternatively, the comment
and commit message could say that the IPv4 multipath tests also move from
raw to datagram ping sockets.

[ ... ]

> @@ -2456,29 +2572,48 @@ test_pmtu_ipv4_mp_asym_exceptions() {
>  	mtu "${ns_r2}" veth_R2-B 1300
>  	mtu "${ns_b}"  veth_B-R2 1300
>  
> -	flow_r1="$(mp_flow_via ${host4_b_addr} veth_A-R1)" || {
> +	flow_r1="$(mp_flow_via ${family} ${dst} veth_A-R1)" || {
>  		err "  no flow through veth_A-R1 found"; return 1; }
> -	flow_r2="$(mp_flow_via ${host4_b_addr} veth_A-R2)" || {
> +	flow_r2="$(mp_flow_via ${family} ${dst} veth_A-R2)" || {
>  		err "  no flow through veth_A-R2 found"; return 1; }
> +	if [ ${family} -eq 4 ]; then
> +		ping_r1="${ping} -I ${flow_r1}"
> +		ping_r2="${ping} -I ${flow_r2}"
> +	else
> +		ping_r1="${ping} -I ${host6_a_addr} -F ${flow_r1}"
> +		ping_r2="${ping} -I ${host6_a_addr} -F ${flow_r2}"
> +	fi
>  
> -	# A Fragmentation Needed from R1 is cached on the path via R1, not on
> -	# the path via R2, whose link can't carry 1400
> -	run_cmd ${ns_a} ping -I ${flow_r1} -q -M want -i 0.1 -c 1 -s 1800 "${host4_b_addr}"
> +	# The error from R1 is cached on the path via R1, not on the path via
> +	# R2, whose link can't carry 1400
> +	run_cmd ${ns_a} ${ping_r1} -q -M want -i 0.1 -c 1 -s 1800 "${dst}"
>  
> -	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R1)"
> -	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R2)"
> +	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R1)"
> +	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R2)"
>  	check_pmtu_value "1400" "${pmtu_a_R1}" "exceeding MTU via R1 (veth_A-R1)" || return 1
>  	check_pmtu_value "" "${pmtu_a_R2}" "exceeding MTU via R1 (veth_A-R2)" || return 1
>  
>  	# The lower MTU behind R2 lowers the PMTU of both paths
> -	run_cmd ${ns_a} ping -I ${flow_r2} -q -M want -i 0.1 -c 1 -s 1280 "${host4_b_addr}"
> +	run_cmd ${ns_a} ${ping_r2} -q -M want -i 0.1 -c 1 -s 1280 "${dst}"
>  
> -	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R1)"
> -	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${host4_b_addr}" oif veth_A-R2)"
> +	pmtu_a_R1="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R1)"
> +	pmtu_a_R2="$(route_get_dst_pmtu_from_exception "${ns_a}" "${dst}" oif veth_A-R2)"
>  	check_pmtu_value "1300" "${pmtu_a_R1}" "exceeding MTU via R2 (veth_A-R1)" || return 1
>  	check_pmtu_value "1300" "${pmtu_a_R2}" "exceeding MTU via R2 (veth_A-R2)" || return 1
>  }
>  
> +test_pmtu_ipv4_mp_asym_exceptions() {
> +	test_pmtu_ipvX_mp_asym_exceptions 4
> +}
> +
> +test_pmtu_ipv6_mp_asym_exceptions() {
> +	test_pmtu_ipvX_mp_asym_exceptions 6
> +}
> +
> +test_pmtu_ipv6_mp_exceptions() {
> +	test_pmtu_ipvX_mp_exceptions 6
> +}
> +
>  usage() {
>  	echo
>  	echo "$0 [OPTIONS] [TEST]..."

[Severity: Medium]
This checks that the error from R1 lands on the path via R1. Does the
test ever reach the case where the PTB lookup picks the other nexthop?

For ICMPv6 datagram ping, icmpv6_err() calls ip6_update_pmtu() with oif
set to skb->dev->ifindex. R1 routes host6_a_addr back over the A-R1
link, so the Packet Too Big arrives on veth_A-R1 and ip6_route_output()
resolves to the R1 nexthop. The second ping works the same way for R2.

The preceding fix walks the nexthops with nexthop_for_each_fib6_nh() or
the fib6_siblings list. However, __ip6_rt_update_pmtu() still returns
early when mtu >= dst6_mtu(dst). That check uses only the single dst
chosen by the lookup, and it runs before any other nexthop is visited.

Suppose the lookup lands on the path via R2. Then dst6_mtu(dst) is 1350,
or 1300 once an exception exists there. A PTB of 1400 from R1 takes the
early return, and rt6_nh_update_pmtu() is never called for the R1
nexthop. The R1 path keeps its link MTU of 2000, so flows on it keep
sending packets that R1 drops.

The lookup can land on another nexthop when the PTB comes back on a
different interface than the one the packet left from. It can also land
there through ip6_sk_update_pmtu() on unbound sockets and through the
tunnel error handlers, which do the lookup with oif 0. The commit
message describes this for rawv6_err().

Should the early return in __ip6_rt_update_pmtu() be limited to routes
without siblings? Or should it only apply per nexthop, after the
multipath walk? Since these tests are meant to catch regressions of the
fix, could they also cover a PTB whose lookup selects the lower MTU
path?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202182545.19656-1-deliran%40verdict.gg

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 18:25 [PATCH net-next v5 0/2] ipv6: Cache pmtu for all paths of a multipath route Vladimir Vdovin
2026-12-02 18:25 ` [PATCH net-next v5 1/2] " Vladimir Vdovin
2026-12-03 19:01   ` netdev-bot+sashiko
2026-12-02 18:25 ` [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests Vladimir Vdovin
2026-12-03 19:01   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox