Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Tue, 01 Dec 2026 06:46
Re: [PATCH net-next v5 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport
Author: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:46
Date: Tue, 01 Dec 2026 06:46
196 lines
15252 bytes
15252 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · 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] In tools/testing/selftests/net/amt_v6.sh, test_local_source()
takes `[ $((d1 - d0)) -ge 3 ]` (line 504) on amtr's rx_dropped as…
- [Medium] In disc_answer() (line 371) and local_src_answers() (line
443), the tcpdump capture runs under `timeout 6`, which starts…
- [Low] In amt_v6.sh, the main body runs `set -E` and `trap 'setup_fail
$LINENO' ERR` (lines 541-542, 546) around setup_topology().
--
selftests: net: add amt_v6.sh for an IPv6 outer transport
This adds amt_v6.sh, a variant of amt.sh that moves the AMT gateway<->relay
link to IPv6 and adds more gateways on that link to exercise the per-/64
tunnel cap. It also checks Packet Too Big handling, that Discoveries sent to
ff02::1 or from the relay's own address get no answer, and that the gateway
rediscovers the relay after 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..8e080d60d5a46
> --- /dev/null
> +++ b/tools/testing/selftests/net/amt_v6.sh
> @@ -0,0 +1,564 @@
[ ... ]
> + SMCDIR=$(mktemp -d)
> + ip netns exec "$RELAY" smcrouted -P "$SMCDIR/pid" -u "$SMCDIR/sock"
> + slowwait 5 test -S "$SMCDIR/sock"
[Severity: Low]
Can this print false setup failures on a run that passes?
The main body runs setup_topology() with errtrace on and the ERR trap set:
set -E
trap 'setup_fail $LINENO' ERR
With set -E, command substitutions inherit the ERR trap. slowwait goes
through loopy_wait() in lib.sh, which runs the probe like this:
if out=$("$@"); then
The if only suppresses the trap for the assignment in the parent shell.
Inside the $(...) subshell, a failing test -S is an ordinary command, so the
inherited trap fires. setup_fail then prints "FAIL: setup failed at line N"
to stderr and exits only that subshell.
smcrouted creates its socket after it daemonizes, so the first polls usually
fail. Each failed poll prints a false FAIL line, even though setup succeeds
and the exit status does not change.
Could this wait run outside the ERR trap, or without set -E?
> + ip netns exec "$RELAY" smcroutectl -u "$SMCDIR/sock" \
> + a relay_src 172.17.0.2 239.0.0.1 amtr
[ ... ]
> +disc_answer()
> +{
> + local dst=$1 filter=$2 pid i rc cap
> + local to="UDP6-SENDTO:[$dst]:2268,sourceport=40000"
> +
> + cap=$(mktemp)
> + ip netns exec "$GATEWAY" timeout 6 \
> + tcpdump -nni gw_relay -c 1 "$filter" > /dev/null 2> "$cap" &
> + pid=$!
> + # The capture is ready once tcpdump says it is listening. If it does
> + # not, whether it is gone or still starting, nothing it reports means
> + # anything.
> + for i in $(seq 50); do
> + grep -q "listening on" "$cap" && break
> + kill -0 "$pid" 2> /dev/null || break
> + sleep 0.1
> + done
> + if ! grep -q "listening on" "$cap"; then
[ ... ]
> + wait "$pid"
> + case $? in
> + 0) return "${rc:-0}" ;;
> + 124) return "${rc:-1}" ;;
> + *) return 2 ;;
> + esac
> +}
[Severity: Medium]
Does the capture always last long enough to cover the sends?
The timeout 6 clock starts when tcpdump is launched. The readiness loop can
take 5 s or more of wall time by itself: 50 iterations, each forking grep
and sleep 0.1. The three sends with 0.5 s sleeps come after that.
The readiness check only greps a file. It still passes if timeout has
already killed tcpdump. In that case the Discoveries go out after the
capture has ended, wait returns 124, and disc_answer() returns 1.
test_mcast_discovery() then treats that as the expected result for ff02::1:
disc_answer ff02::1 "udp and src port 2268 and dst port 40000"
[ $? -eq 1 ]
The commit message says:
The ff02::1 check accepts only "no reply", so a broken capture
cannot pass it.
Is that still true when tcpdump reports listening late? The unicast positive
control runs in a separate, earlier tcpdump instance, so it says nothing
about this capture's window.
local_src_answers() has the same overlap with its own timeout 6. If tcpdump
is gone before the sends, this gives 0 with status 0:
ANSWERS=$(grep -c "UDP" "$cap")
The "not answered" check in test_local_source() then passes without having
observed anything. The same timing would also make the positive checks fail
spuriously.
Could the deadline start once tcpdump reports listening, or could the
capture be stopped explicitly after the sends?
[ ... ]
> +# A Discovery that comes in from the wire with one of the relay's own
> +# addresses as its source is not answered: the Advertisement would go to this
> +# host over lo, where a rule such as "-i lo -j ACCEPT" lets it in. IPv4 input
> +# refuses such a source as a martian; IPv6 input does not. SPOOF holds the
> +# address on its lo only, so nothing on the link announces it, and sends from
> +# it out of its own veth. The relay counts each drop in rx_dropped, which shows
> +# that the Discovery got there. The same address over lo is a gateway on the
> +# relay's own host, which IPv4 accepts too, and is answered.
> +test_local_source()
> +{
[ ... ]
> + d0=$(rx_dropped)
> + local_src_answers "$SPOOF" ",so-bindtodevice=spoof_relay"
> + check_err $? "the capture on lo did not start, or a send failed"
> + d1=$(rx_dropped)
> + [ "$ANSWERS" -eq 0 ]
> + check_err $? "the relay answered its own address, $ANSWERS times"
> + [ $((d1 - d0)) -ge 3 ]
> + check_err $? "the relay dropped $((d1 - d0)) of the 3 Discoveries"
[Severity: Medium]
Does the rx_dropped delta really show that the spoofed Discoveries reached
the relay?
amtr's rx_dropped also counts other drops, and test_source_cap() leaves one
of them running. It creates amtg4 when 2001:db8:a::/64 is already at its
per-source cap, and nothing deletes it:
ip -n "$GATEWAY2" link add amtg4 type amt mode gateway \
local "$GW4_6" discovery "$DISC6" dev gw4_relay \
gateway_port 2268 relay_port 2268
amtg4 keeps running amt_event_send_request(). Each cycle sends an IGMP
Request and an MLD Request, with a 2/4/8/16 s backoff. It then rediscovers
the relay and starts over.
On the relay, amt_request_handler() rejects each of these Requests:
if (!have && (full || per_src >= amt_max_tunnels_per_src(amt)))
return true;
amt_rcv() then increments amt->dev->stats.rx_dropped, the same counter that
rx_dropped() reads.
The d0/d1 window here lasts a few seconds, so one or two amtg4 cycles can
add 2 or 4 drops. Suppose the SPOOF Discoveries never reach the relay, for
example because the SPOOF veth or bridge setup is broken. Couldn't the delta
still reach 3? ANSWERS would stay 0, and the check would pass without
testing anything.
Would it help to delete amtg4 at the end of test_source_cap(), or to check
something specific to this drop?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130064249.1874523-1-omar%40blockcast.net
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads