Article View: linux.kernel.netdev
Article #22359Re: [PATCH] selftests: netfilter: fix missing echo in nft_nat_zones.sh
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 07:44
Date: Wed, 25 Nov 2026 07:44
114 lines
12447 bytes
12447 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 0 (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).
- [High] The patch fixes a statement that can never run, so it does not
do what the commit message says.
- [Medium] The diagnostic this patch turns into a real message, `echo
"FAIL: Ping failure from $cl"` on line 174 of…
Pre-existing issues:
- [Low] On the veth0 icmp counter-mismatch path in
tools/testing/selftests/net/netfilter/nft_nat_zones.sh, the check on…
--
selftests: netfilter: fix missing echo in nft_nat_zones.sh
The patch adds a missing echo to the ping failure diagnostic in
nft_nat_zones.sh. Without it, the shell tries to run the message string
as a command. The commit message says this makes ping failures get
reported the same way as the script's other failure paths.
> diff --git a/tools/testing/selftests/net/netfilter/nft_nat_zones.sh b/tools/testing/selftests/net/netfilter/nft_nat_zones.sh
> index d935c967dd13b..f15bfd33739f1 100755
> --- a/tools/testing/selftests/net/netfilter/nft_nat_zones.sh
> +++ b/tools/testing/selftests/net/netfilter/nft_nat_zones.sh
> @@ -171,7 +171,7 @@ done
>
> wait || ret=1
>
> -[ "$ret" -ne 0 ] && "FAIL: Ping failure from $cl" 1>&2
> +[ "$ret" -ne 0 ] && echo "FAIL: Ping failure from $cl" 1>&2
[Severity: High]
Can this echo ever run? The script is #!/bin/bash, and the loop above
starts the pings in the background without saving their PIDs:
ip netns exec "$cl" ping -i 0.5 -q -c 3 10.3.0.99 > /dev/null 2>&1 &
In bash, a bare wait with no arguments returns zero once all background
jobs finish, whatever their exit status. The only trap in the script is
on EXIT, so no trapped signal can make wait fail either. That means
"wait || ret=1" never sets ret.
ret is set to 0 near the top of nft_nat_zones.sh, and nothing else
assigns it before this check. All the other ret=1 assignments come
later. So [ "$ret" -ne 0 ] looks to be always false, both before and
after this patch.
If that's right, the "command not found" and 127 symptom described in
the commit message can't happen on an unmodified run. A failed client
ping would also still go unreported here.
Would it make more sense to replace "wait || ret=1" with a per-PID wait?
For example, save pids[$i]=$! in the ping loop, then call
wait "${pids[$i]}" for each client and set ret and print the failure on
error. nft_flowtable.sh in the same directory uses wait $lpid this way.
Also, before d6905f088d2b the loop checked $? right after "ping ... &".
That is also always 0, so it looks like ping failure detection never
worked at this point. Backporting with the current Fixes: tag would not
bring back any ping failure detection.
[Severity: Medium]
Which client will this message name? cl is the loop variable from the
background ping loop:
for i in $(seq 1 "$maxclients"); do
cl=$(eval echo \$cl"$i")
ip netns exec "$cl" ping ... &
done
After the loop, cl always holds the namespace for i == maxclients (100,
or 40 with KSFT_MACHINE_SLOW=yes). A failure from client 5, for example,
would be reported as coming from the last client.
The socat failure path later in the script prints $cl inside its loop,
so it names the correct client:
echo "FAIL: Failure to connect for $cl" 1>&2
The wrong name came in with d6905f088d2b, when the message moved out of
the loop. Since this patch presents the line as the fix for ping failure
reporting, could the respin also report from inside a per-client wait
loop?
[ ... ]
[Severity: Low]
This is a pre-existing issue, and this patch did not introduce it. It is
in the same script, outside the quoted hunk. On the veth0 icmp counter
mismatch path, the check looks up one key and the debug dump looks up a
different one:
if ! ip netns exec "$gw" nft get element inet raw inicmp "{ 10.3.0.99 . \"veth0\" . 10.3.0.1 }" | grep -q ...
...
ip netns exec "$gw" nft get element inet raw inicmp "{ 10.3.99 . \"veth0\" . 10.3.0.1 }" 1>&2
Should 10.3.99 in the debug dump be 10.3.0.99, to match the key that was
checked?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124071926.8818-1-zhiqizhangg%40gmail.com
Technical Details
Message-ID:
<179559265058.3135.11860282333221465868@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-371104-linux-kernel-netdev=dewy.ruReferences:
<20261124071926.8818-1-zhiqizhangg@gmail.com>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-371104-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] selftests: netfilter: fix missing echo in nft_nat_zones.sh Date: Wed, 25 Nov 2026 07:44:10 +0000 Organization: Usenet Network Message-ID: <179559265058.3135.11860282333221465868@kernel.org> References: <20261124071926.8818-1-zhiqizhangg@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="147704"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:HvQBMdvmi/VgjoF1HeXX6NLMvto= sha256:2wT+izP5VBB6LSKdwB2mXXJeG+wTSUFVcrH3k6gKiX0= sha1:ZdlJ8TptnSBF7nyK+/5Yawz29BI= sha256:BzHsZi8jjWkKLu/mrzKirlUcOdGWW5wbqftzAfOshXI= 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 067B1125E40; Wed, 25 Nov 2026 10:44:48 +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 Cu1_HrYC78qM; Wed, 25 Nov 2026 10:44:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371104-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 03D01125E3D; Wed, 25 Nov 2026 10:44:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id DCF6335A50; Wed, 25 Nov 2026 07:44:30 +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=1795592668; b=RdOodLWfGns4kTyMs/hAuODsN41PoIXSyi/d4QWdyfncgH1/FA2Xqw+fGcRL9SanI6U1 ARxP+l6BYzbPZPKkfXmbAPmpCcgsDzjZr7mfaDA82zEtl4iamXT62T9du+dw8bvJq4JP0 iKHITjUAjdTgBANVMyYIwwk+CaOX79xQYWpL9f1JgRBfKmnBym40hQv+784xgMa3HnJ8T PKI7LFdXzLGpv6Drrrw8k967XuafniWGOs5+ULDCMlwj5sWp4PA+Vm3MOcmPOM59Lefoq tPAmMz6zU+GNalldqkKuZbAXUZhvtNz1G2yysFDINNqOhuRgeLpGEUs0hDRodTM8EJQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795592668; 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=KGPByt1l/w2w5NVSgCv2fP9X+uQOLitOIGrz+voENZ4=; b=3bOpLmCp9kb/kswCefpB4AB1WAme8YQ97m2f7dcMWKavQRB6T/Lf3I3S6sDt969AMsDQ Ihcok3dTdPuRnceYH2K159hmV91C1I6CcAFONdErp5Bx3n7Eioqxg9X37LmeKPuNBsmOd uW5phQgOd/0ozmyc5NWAONTr4Srh8h2Eu+Bm6TYDJ9Sm67raI6otFOl2cZHxwg6sV9GHU A1Xj+ycC2ImSs6zLiUVgDVbXVJ/BUXsqDAGVWESr5MACgm7siZNNB3HEltU6hDqZu3JpB zzgVurtZ6MYrcIG3aa5IEUGw9OnTgWvXGaLZLnV3+ajcvgMvPwCp6KFpatOScvAkHnw== 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=mOTYLjeo; 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 28E36606A331; Wed, 25 Nov 2026 07:44:28 +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=mOTYLjeo 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=1795592652; b=EfkvIO9T9Fk2ZJE2OV/8JG/p7JFtV5Xyf8cxSX3Ae5NT/2zYiGnoA2VZyPlAaJZCa1Yi tavOp3qSkZ0L2HXbiNp47zKjv+BYWR8rBqvLvuoCHZPYjIXA21+n+PsCh1wyRpBgmno7V ILXsDePiGRtQ6MWMsUIf7fMfZ6qkm0z3/zgnGViXt8HRAw0jvN810KN2JIE80/AQzl1qw 554mv/mZWOf+RxgU1Y0zqMmSZs5Ja7/DzbedIeh6+zWoIESqs+WWzW8oeH5seHy60Dz4B UCEdcR2iQyfXezYFjEG4wf2brHEGZ2MxvfridYoYZVxdMcv3cMOK1Z5IRyBrp1Im6QA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795592652; 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=KGPByt1l/w2w5NVSgCv2fP9X+uQOLitOIGrz+voENZ4=; b=aUVEq9Xinln5/52dkm9Fd6U4rgeaP1HUKnukcXunMP8rnn1cpXuMOngFLjRU4fSHkHll aG4NCqlAmLhz/5tdgY5c747d4gHuRHFue4NlQt3RfxR3sLUNNIKtCe9cM4IMvO8zO4sUh l1XXcB+GG8NpEZJjpMljjT+zWZUulxVdQszY6UFwmeo6r1VOiFY8VcRko+DJT8zxoI7gF C5I+Ne4Qe16R2ytRI9AuKdISosu/JQeH6Go8rpbq+llpniqCN489dxaeCg+6CfQtz8v0R Dak1yc+5rIGBLHsSbo94zABkjjhZvQkkVsEbaVsSgQj4iCElRB3lSFe1qpoRquOdNZw== 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=mOTYLjeo; 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 41EA6606A321; Wed, 25 Nov 2026 07:44:11 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A1BC1F000C4; Wed, 25 Nov 2026 07:44:10 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795592651; bh=KGPByt1l/w2w5NVSgCv2fP9X+uQOLitOIGrz+voENZ4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=mOTYLjeoSuWpYR+AWHxkzZH/8kuw+oTfJZrBa+eZH/RZg7dC8oyxWEZEOlh/1dmFr DEoR5cBmihCIzEQGG/tuNQMzU6n5c6FItNMz3+jfpKUXOI3EaONmV9aoL1+38Ewzip 7ZTBg5Oq7Js+Pkt94LaeGDNslRp+C8QGRMd42PScLGVEJvMjl5wM7FzkvjaCSpiCMe WPiljurDQMF3MSqAkwcZXaxKpkCk1Bbo80MrABk8VgLJKaDZQG9k774d4n1UO/yaR5 hUiNGCq8gDJdpx0sN+PoR4XP0ptEXjuGAIsuYNCVl8USZMXeQxQopUNyfAjjH6iF6C CktNrPUkcEpRA== X-Cc: pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261124071926.8818-1-zhiqizhangg@gmail.com> X-sashiko-severity: High 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