🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24364

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

#24364
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 03:48
185 lines
14118 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

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

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, disc_answer() can
  report "no reply" for a capture that never started.
- [Low] In setup_links() in tools/testing/selftests/net/amt_v6.sh, the
  comment says "(amtr is NOARP and skips DAD on its own.)".
- [Low] Concern: setup_topology() calls `slowwait 5 test -S
  "$SMCDIR/sock"` while `set -E` and `trap 'setup_fail $LINENO' ERR` are…

--

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

This adds amt_v6.sh, a variant of amt.sh in which the AMT gateways and the
relay talk to each other over an IPv6 outer link. It checks:

  - discovery through a secondary relay address
  - IPv4 and IPv6 multicast forwarding
  - the per-/64 tunnel cap
  - tunnel MTU handling
  - that a Discovery sent to ff02::1 gets no answer
  - 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..923c2b374ce53
> --- /dev/null
> +++ b/tools/testing/selftests/net/amt_v6.sh
> @@ -0,0 +1,469 @@

[ ... ]

> +setup_links()
> +{
> +	local ns
> +
> +	# No DAD: the global addresses of the gateway and relay links must
> +	# not be tentative, or the gateways could neither bind to them nor
> +	# send from them. (amtr is NOARP and skips DAD on its own.)

[Severity: Low]
Is the "amtr is NOARP" part of this comment accurate? amt_link_setup() in
drivers/net/amt.c does set IFF_NOARP, but it calls ether_setup() last:

drivers/net/amt.c:amt_link_setup() {
    ...
	dev->type		= ARPHRD_NONE;
	dev->flags		= IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
    ...
	ether_setup(dev);
}

ether_setup() always sets dev->type = ARPHRD_ETHER and
dev->flags = IFF_BROADCAST|IFF_MULTICAST. That means amtr ends up without
IFF_NOARP and goes through normal DAD.

The test still works because $RELAY is in the accept_dad=0 loop below, and
amtr is created after default.accept_dad=0 is set. Could the note in
parentheses be fixed or removed? Otherwise someone may drop $RELAY from the
loop because of it.

> +	for ns in "$LISTENER" "$GATEWAY" "$GATEWAY2" "$RELAY" "$SOURCE"; do
> +		ip netns exec "$ns" sysctl -wq \
> +			net.ipv6.conf.all.accept_dad=0 \
> +			net.ipv6.conf.default.accept_dad=0
> +	done

[ ... ]

> +	SMCDIR=$(mktemp -d)
> +	ip netns exec "$RELAY" smcrouted -P "$SMCDIR/pid" -u "$SMCDIR/sock"
> +	slowwait 5 test -S "$SMCDIR/sock"

[Severity: Low]
Can the inherited ERR trap fire inside this slowwait? setup_topology() runs
with errtrace on and the setup_fail ERR trap installed:

    set -E
    trap 'setup_fail $LINENO' ERR
    ...
    setup_topology

loopy_wait() in lib.sh runs the polled command inside a command
substitution:

    if out=$("$@"); then

With set -E, command substitutions inherit the ERR trap. smcrouted
daemonizes before it creates its socket, so the first test -S calls can
fail.

If the trap fires there, setup_fail prints "FAIL: setup failed at line N"
to stderr. Its exit only leaves the substitution subshell, so setup goes on
and the run can still pass.

Bash may suppress this, because the substitution is the condition of an if
and the ignore-return state may carry into the subshell. If so, nothing is
printed. Has this been checked against the bash versions used in CI, so
the output does not show stray FAIL lines?

> +	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; it is gone
> +	# before that only if it failed to start.
> +	for i in $(seq 50); do
> +		grep -q "listening on" "$cap" && break
> +		if ! kill -0 "$pid" 2> /dev/null; then
> +			wait "$pid"
> +			rm -f "$cap"
> +			return 2
> +		fi
> +		sleep 0.1
> +	done
> +	rm -f "$cap"

[Severity: Medium]
What happens if tcpdump is still running but has not printed "listening
on" after all 50 tries? The loop just ends without returning 2. The sends
then go ahead as if the capture were armed.

The 6 second timeout started when tcpdump was launched. After about 5
seconds of polling, only about 1 second is left. The three sends below take
at least 1.5 seconds, so timeout can kill tcpdump before or during them.
The status handling then gives:

	wait "$pid"
	case $? in
	0) return "${rc:-0}" ;;
	124) return "${rc:-1}" ;;

wait returns 124, rc is unset, and disc_answer() returns 1. That is the
same status as a real "no reply". test_mcast_discovery() treats 1 as a pass
for the ff02::1 check:

	disc_answer ff02::1 "udp and src port 2268 and dst port 40000"
	[ $? -eq 1 ]

The ff02::1 check can therefore pass even though no capture covered the
sends. The earlier unicast control ran its own tcpdump, so it does not
show that this one worked.

This also seems to contradict the function comment ("2 if the harness
failed: tcpdump did not start") and the commit message:

  The ff02::1 check accepts only "no reply", so a broken capture cannot
  pass it.

Should disc_answer() kill tcpdump and return 2 when the loop ends without
seeing "listening on"? Starting the capture deadline only once tcpdump is
listening may also help.

> +	# Type 1 (Relay Discovery), version 0, then a nonce.
> +	for i in 1 2 3; do
> +		printf '\x01\x00\x00\x00\x12\x34\x56\x78' |
> +			ip netns exec "$GATEWAY" socat -u - \
> +			"$to,so-bindtodevice=gw_relay" || rc=2
> +		sleep 0.5
> +	done

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129034652.1853485-1-omar%40blockcast.net
Technical Details
Message-ID: <179601051449.3146.7267005649784031183@kernel.org>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373832-linux-kernel-netdev=dewy.ru
References: <20261129034652.1853485-12-omar@blockcast.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373832-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 11/12] selftests: net: add amt_v6.sh for an
 IPv6 outer transport
Date: Mon, 30 Nov 2026 03:48:34 +0000
Organization: Usenet Network
Message-ID: <179601051449.3146.7267005649784031183@kernel.org>
References: <20261129034652.1853485-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="1325338"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zXwvRxruKx1BLoRhNIyqc85MDiU= sha256:74t0V+HV98T0UvtfGFkL7E0SxAvX69tpf5/jvjoeEDQ=
	sha1:V/sBA1Ay1ACoHnwSxB4PkKQr/48= sha256:sDZwb8SCRFr7IETo5nUQhI8nHnTpJwbCS5EjFCJ4+C8=
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 7BED6125D6D; Mon, 30 Nov 2026 06:49:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 VrqrxrcLSUBA;
	Mon, 30 Nov 2026 06:49:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373832-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 B33C8125FBC; Mon, 30 Nov 2026 06:49:19 +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 20BEF29DAF; Mon, 30 Nov 2026 03:48:45 +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=1796010522;
	b=EW2+im64ayUNteY3IKuafIKzmCXogtPE9s8Psd0bKO8klEWQSL3A+3bbpv4XZudz6Kqx
	 fpglgpCh1N/TIUBr3qsRWOEEbXDyfzZEaVFwdWWETrCxQh8zDHfu2mTrGwRFUIkSvtEt7
	 f9HgHar/fdGF2Sg+Avegjt5S4xczKzZTuH9di5dj7QcN7o+izlu7/1tptFEulIauDHJSr
	 PHJcQlQ+ja5Zpq7+ltiF0GBrWyXjYkah3jAtrmSAdJg6smCvCQjz4WhiUtpiK77AoyLZC
	 s20Ll2T3KIxWy31d6zIBYGYkI2ZB33EddAwZ5a7J+eTedkkGJfHeOVjVzhwZ9wqBgDw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796010522;
	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=kx82iYKKTZFQEuIMjvpcGnQuxPmoG218HOThHCI6q4Q=;
	b=wcp94GfmYa9QoONe+Di+BP8P4YseV8ssH85p9R1ti1kdUxCPIbiC8MqZWjsrmih9PEzY
	 Wy7QaaQL4WO3BULPDtOj09qjtScLlF7GLYRt0/pV9c4H4CXoVUZFVJ0ag/O1Ahhzft5js
	 ga3bC/CaVvzS8EjmR5/5xvLW4k3sQ8HTvvTlL8DM4SNh6aE1gZJmvtmDKWFNyv0O3IC17
	 SnDjbe9NOFb1aq6wcn+rA1djP4NmoFXw4Lqxk6yPj3O1JTn4QJGidyECfsmxNpncl7GWa
	 9NPlJIw6qBh1EZLtHWJtWke2q3PFwyv3eLlJ9pGdt4JOl2quJZcpbxj7H5OCje029pQ==
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=HXJFQvpb;
	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 672E4606A32E;
	Mon, 30 Nov 2026 03:48:42 +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=HXJFQvpb
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=1796010516;
	b=Eyg87WQCndByY/41ayYFxkh/ZNoSpKL2NMeVuUnDaCtru2cYRV3SIMlsAt9vQrncsgir
	 ULBK8y+ryB0jC4NSjg66ckxJLOq8/1vTr38EcmrbTF2nB7aBqag5MdN1YHR8z4oU1yr2e
	 LBmrf4UA01vl/HiVN/1dN0jkIHIYA9KcbcgR5NKqg1HOWndsfiCeUnpx6nZ/sJ9Lslav8
	 vrmBRjCEduJhU6Y2hMK9UXsmmR4OOM+cOVG3YDC5CCw3yBKI8MDORX2ezbAP9eaPxB4XD
	 3Itn6j9K/v8zGfsntSKQ0f3vbZCIyKE9k9lqBRTOB/sHjG0yomOhjRGKJ7E9FmQV8Zg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796010516;
	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=kx82iYKKTZFQEuIMjvpcGnQuxPmoG218HOThHCI6q4Q=;
	b=peHZeXXN9JdVfYxXMduzmf5P27du45o3j4bgsG7gpSNqFDIMlIacmdFh9yapIdAQ4sy5
	 726GI19+gnBgT3mH2dmMainPsPwxDdcLebA6I9+UXFsyrkNfnnU9IvoiKM7Kz2ODwQO7j
	 6JproY2xeN30vZpQWFlrtjNg+z8HisrMGxzAZworRsVRy9Pw/wax4NhguFOo92VkzF7FD
	 Mir53kvS5g59kGHEtg9ML51hfOzHN3mzgz1QABGL0s6eeU+DsudB1ivTy84pIaz9IPN9M
	 Uq0V4UeQPIRbiUDO/IbwB79Q6IxYA2oMA8nICXkixMVmfpo1wdsjwwgltCLPjg+WrmA==
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=HXJFQvpb;
	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 83A3B606A329;
	Mon, 30 Nov 2026 03:48:36 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E96381F00936;
	Mon, 30 Nov 2026 03:48:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796010515;
	bh=kx82iYKKTZFQEuIMjvpcGnQuxPmoG218HOThHCI6q4Q=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=HXJFQvpbwVWBcc0aJ/4Zo4cDdWuKDhHfWrRsw8Mc9EMHOLBlqE4ERdEOd1xUBRpE6
	 teUjTDH+95xeo83X4J/+syIT3mCUbiD5DcRSUvChEna6kkuEqB1qrDi/MyQ1iutMAc
	 0wsiXGFM0VcHeFI3TySdxs0PBIFO8oN8YT6ypUsO2kvA35/MKG9F1uXYTuVJq0TCkC
	 grAVym4+KUR0LB27ZfQ4t3/cXXu46fHKZdu7TBQ4iDszI9pHp1U9cIjZiyUXfNhZKU
	 Hf8/SKalqo6NAoTiaeI8fRbl8RB5B4tggqwo1TorWPnyqQGjzW2/VTIGUYrKBfMIjj
	 2hJ2bT5zfZAaQ==
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: <20261129034652.1853485-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