From: netdev-bot+sashiko@kernel.org
To: zhiqizhangg@gmail.com
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
Subject: Re: [PATCH] selftests: netfilter: fix missing echo in nft_nat_zones.sh
Date: Wed, 25 Nov 2026 07:44:10 +0000 [thread overview]
Message-ID: <179559265058.3135.11860282333221465868@kernel.org> (raw)
In-Reply-To: <20261124071926.8818-1-zhiqizhangg@gmail.com>
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
next prev parent reply other threads:[~2026-11-25 7:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 7:19 Zhiqi Zhang
2026-11-24 9:21 ` Florian Westphal
2026-11-25 7:44 ` netdev-bot+sashiko [this message]
2026-11-25 8:44 ` [PATCH v2] selftests: netfilter: fix nft_nat_zones.sh diagnostics Zhiqi Zhang
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=179559265058.3135.11860282333221465868@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--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=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=shuah@kernel.org \
--cc=zhiqizhangg@gmail.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®