Article View: linux.kernel.netdev
Article #25016Re: [PATCH net-next v5 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport
From: 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
Technical Details
Message-ID:
<179610758393.3146.1477119977377490689@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374759-linux-kernel-netdev=dewy.ruReferences:
<20261130064249.1874523-12-omar@blockcast.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374759-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179610758393.3146.1477119977377490689@kernel.org> References: <20261130064249.1874523-12-omar@blockcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1639774"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:iVtbEnSSbom7ufozMy/Ea2L9TYE= sha256:E+9y3XptaKVIWWYgj5P4LlDHggCR+uVM2MGvZEYKkPI= sha1:YfrA7JtCimDywnXQvLplfWafYos= sha256:h1WXvfE/Qxo6eZPiCul8k1MAKXHVkuDYbb3IeBGM90s= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 59A2311727B; Tue, 1 Dec 2026 09:47:24 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1IvGGuSddMlx; Tue, 1 Dec 2026 09:47:20 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374759-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 75BF9117276; Tue, 1 Dec 2026 09:47:12 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id CAEB92F867; Tue, 1 Dec 2026 06:46:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796107586; b=Kypk7+S+23yLVFqnFua5I8qI2vwQGRRIB7V9IPv8PplB3Uuey5TlXKuRXtUZZmbtUbcs KBwh7aOCU8wnHtNfqhGFFj85Lc1XFtimvt1kzOO1OqbgtPBA9Oq91KtMn+nvw9u00ehBh 2ihUeUaxhi9c32ppss/v32A/HFo7nulCp+5jd5LcBaVwH1fTxvoFz3ZDIZjMdROsnt8JO u6w2jbrr5pGKbVVIFDSrWdAGszBeLn8j7Is1oyHVYC5I1WcFSAHzZk6NmibrhME3RDWtk +NFe42ZHorUIbfDCtALk8RWVY7qN4bOwRwUA4bndy0ZBWG47huJ1OjMeeAaYExWaLyQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107586; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=CODcADl0U6Av0ZfaLM+Jw0yTB2O7KgfzizrbSd9zM5U=; b=lzf/zaIjPbyCFTMpgwT1RouSUY8jWM9He4J4n9yeIFvN+mvNF5eemKp9ahy3CtBAii0V RpV5IsE+aMKPFM8sAU3BmdpUpIPqMEP08C98V+bdh202c+4bS1fvaRivpsNxJEIH4l+bj i9rH7LkuyeCI3XnKHFoH8wHnEVzNNUhQZLXaWM3lMQ0zDrkSad6w3edT6pNFwnkq/mMNM /9tk5J+NaL2rgTxkSx2vOJ05ODox1mdnuj8pa46BTs1Y5l78XfIIqnArsRV9W2jaKc0z1 V8gxf+GFwNR/JQt4ESckapWiGEqVFzTkist9XyX2l+/d0nUq69iLG+3ippAS6UKvVuw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MUFQZPQI; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34D1B606A681; Tue, 1 Dec 2026 06:46:26 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MUFQZPQI X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796107585; b=zWvId8v2ikB8XCrMXYnY2skDwaVERemsU602v9NaF0gG/c1fZoAQOAqCftK/jEMuUjTK WiQfag+yRYA5GO2HMfRM+8reTYRBN0A4TxZb7h+UzslZqO/RHyiyR24El4bObSbFlEZ7a tTL2/cTLuCUt5MGAnqj81o8D5RqwV3VZaQOb4XlCCK2ZxtC0KrcMGgmEomugw/8qWKSPs f4vf0A2a1dhk2LAM0w9n2WBFPySROXBzTkFkm02pp53MksEzqyV5TiYLduGTMzYN68YDd W1uYKd3mHXfPO4U3GzDakSApNurJ7k6cwepjrUnsjksekkvSvMxiJdEHUcImzKXgQpA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107585; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=CODcADl0U6Av0ZfaLM+Jw0yTB2O7KgfzizrbSd9zM5U=; b=s/BHQMBbgyqxaSNtKVO0NGy9T41M/eSpBXHQ3s1Yz/UuUaBEUKS8ggnDVyRTKyc83TP1 ac13g51seO42uO7E25jMwoHNTMXpHh6AjKgwNmnRRB5Arm2Kj6FjMAlk8bKWojJ53FjfV g77Jl5+eXmkjJ5eGjaHBasf+wtEtUsgRbqsJjYRQpggcHphntD7Kgxw5+Ry+h7WqXHHg2 wAXj73Q6Df9TsvCSM2PCHBZ8Xkn1KMaxmA3NJjY7HbnTj98YeYQGtfMJzZHx6vBLCTd3X sPs7/NHzDiT7cGqCCtohh9NOJYeocBz6BtX/ePdOK6+DU/gWeDj1Mj8D7BMWYtLDAQw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MUFQZPQI; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57CA2606A688; Tue, 1 Dec 2026 06:46:25 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66C441F00930; Tue, 1 Dec 2026 06:46:24 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796107585; bh=CODcADl0U6Av0ZfaLM+Jw0yTB2O7KgfzizrbSd9zM5U=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MUFQZPQII8VMywhVF+Tqw76EgQz1ez9OWJ1qEu0gR0TcK+n/Ju++RK2p1kAhmaZfc a+kW7vaG9Vr1AEsW+Mn78f6cs14En/NaITqD+PWR8nGSda9QytSBkxKuicC73gNFPk osyHdKRy/L8wai4XOC+uJOXE+8ZWEZyvVB3uhq5dCN0ug21zVa8/QiRvaT9XDf31mg TjdeDFthYe7vUvA4b+v509uKitruw9qcAcZYm9/ksRtWvFJP82aJoMBWVakTpR/o1A bPctY/LfyIcWMlMNRNFux/zQNJ0xAKC+/s5GxPZdu5x7OW1io/mZ16R7jFpXKZiGKN lNPWhvXeKZxAQ== X-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 X-In-Reply-To: <20261130064249.1874523-12-omar@blockcast.net> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list