Re: [PATCH net-next v6 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport

From: netdev-bot+sashiko

Date: Wed Dec 02 2026 - 23:33:52 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In tools/testing/selftests/net/amt_v6.sh, the header comment of
test_tmtu() reads "With the route MTU to the gateway below the…
- [Low] In tools/testing/selftests/net/amt_v6.sh, test_forward() starts
the listener with `ip netns exec "$ns" timeout 20 socat -u ...`, so it…

--

selftests: net: add amt_v6.sh for an IPv6 outer transport

This adds amt_v6.sh, a variant of amt.sh in which the gateway<->relay link
runs over IPv6, with a second gateway on that link. It covers discovery,
IPv4/IPv6 multicast forwarding, the per-/64 tunnel cap and tunnel MTU
drops. It also covers Packet Too Big for SSM groups, multicast and
local-source Discovery handling, and gateway down/up.

> diff --git a/tools/testing/selftests/net/amt_v6.sh b/tools/testing/selftests/net/amt_v6.sh
> new file mode 100755
> index 0000000000000..c5447ffeaa4f7
> --- /dev/null
> +++ b/tools/testing/selftests/net/amt_v6.sh
> @@ -0,0 +1,716 @@

[ ... ]

> +test_forward()
> +{
> + local ns=$1 addr=$2 port=$3 grp=$4 src=$5 desc=$6 want=${7:-data}
> + local out pid i rc
> +
> + RET=0
> + out=$(mktemp)
> + ip netns exec "$ns" timeout 20 \
> + socat -u "$addr,readbytes=128" - > "$out" &
> + pid=$!
> + wait_local_port_listen "$ns" "$port" udp
> + # Paced to outlast a Request/Query refresh of the gateway.
> + for i in $(seq 40); do
> + ip netns exec "$SOURCE" bash -c \
> + "printf '%s %128s' $src | nc -w 1 -u $grp $port"
> + [ "$want" = data ] && grep -q "$src" "$out" && break
> + sleep 0.25
> + done

[Severity: Low]
Can this loop keep sending well after the listener is gone?

The listener is limited to 20 seconds by timeout 20. The loop only exits
early in the data case once the source shows up in $out. Nothing checks
whether the listener is still running, for example with kill -0 "$pid".

With an OpenBSD or traditional netcat, nc -w 1 waits up to a second after
stdin EOF. Each iteration then takes about 1.25s, so the 40 iterations
take about 50s.

In the "none" case ("a third gateway in a /64 at its cap gets no tunnel")
and in any failing data case, the loop always runs all 40 iterations. That
means roughly 30s of datagrams go out after the listener has exited, and
nothing observes them.

So the window in which the refused gateway is shown to get nothing is the
listener's 20s, not the longer sending window that the "Paced to outlast"
comment suggests. Each such run also adds about 30s.

Would it make sense to break out of the loop once the listener exits? The
other option is to match the listener timeout to the length of the loop.

> + wait "$pid"
> + rc=$?

[ ... ]

> +# With the route MTU to the gateway below the payload, the relay must drop the
> +# payload without fragmenting it, and send its source a Packet Too Big only
> +# for an SSM group (RFC 7450 s5.3.3.6.2.2).
> +# test_tmtu <group> <ptb|none> <description>
> +test_tmtu()
> +{
> + local grp=$1 want=$2 desc=$3
> + local ptb frag fragfail drop i
> +
> + RET=0
> + ip -n "$RELAY" -6 route add "$GW6/128" dev br_gw mtu 1400

[ ... ]

> + for i in 1 2 3; do
> + ip netns exec "$SOURCE" bash -c \
> + "printf '%1352s' x | nc -w 1 -u $grp 6000"
> + done

[Severity: Low]
Does the header comment of test_tmtu() describe the right condition?

It says "With the route MTU to the gateway below the payload". The route
MTU is 1400, and the inner IPv6 packet is 40 + 8 + 1352 = 1400 bytes. The
route MTU is therefore equal to the payload, not below it.

The drop happens because the payload is above the tunnel MTU. In
drivers/net/amt.c:

drivers/net/amt.c:amt_tmtu() {
u32 hlen = sizeof(struct ipv6hdr) + sizeof(struct udphdr) +
sizeof(struct amt_header_mcast_data);
u32 mtu = dst_mtu(dst);

return mtu > hlen ? mtu - hlen : 0;
}

That gives 1400 - 50 = 1350. amt_send_multicast_data() then drops the
1400-byte skb through amt_tmtu_exceeded().

The kernel comment above amt_tmtu(), the test descriptions and the commit
message all describe the threshold as the tunnel MTU. Should this comment
say "payload above the tunnel MTU" as well?

Someone who sets the route MTU from this comment, for example to
payload + 1, would no longer exercise the drop path.

> + # The drops show that the payload reached the tunnel, so that "none" is
> + # not a send that never ran. -gt: the first Packet Too Big caches a path
> + # MTU in the source, so later datagrams may be fragmented, not dropped.

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202043200.286260-1-omar%40blockcast.net