From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
shuah@kernel.org, horms@kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
willemb@google.com
Subject: Re: [PATCH net-next v5 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport
Date: Tue, 01 Dec 2026 06:46:23 +0000 [thread overview]
Message-ID: <179610758393.3146.1477119977377490689@kernel.org> (raw)
In-Reply-To: <20261130064249.1874523-12-omar@blockcast.net>
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
next prev parent reply other threads:[~2026-12-01 6:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 6:42 [PATCH net-next v5 00/12] amt: add " Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko
2026-11-30 6:42 ` [PATCH net-next v5 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko
2026-11-30 6:42 ` [PATCH net-next v5 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 05/12] amt: forward multicast data " Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko
2026-11-30 6:42 ` [PATCH net-next v5 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 08/12] amt: receive " Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko
2026-11-30 6:42 ` [PATCH net-next v5 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-30 6:42 ` [PATCH net-next v5 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko [this message]
2026-11-30 6:42 ` [PATCH net-next v5 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-12-01 6:46 ` netdev-bot+sashiko
2026-11-30 17:27 ` [PATCH net-next v5 00/12] amt: add an IPv6 outer transport Matthieu Baerts
2026-12-01 8:48 ` Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179610758393.3146.1477119977377490689@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omar@blockcast.net \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®