Skip to contentSkip to conversation

selftests: netfilter: Fix skip of wildcard interface test

PATCH Applied Phil Sutter 4 participants 4 messages May 27, 2025 – May 28, 2025

Subsystems (4)
lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 selftests: netfilter: Fix skip of wildcard interface test

The script is supposed to skip wildcard interface testing if unsupported by the host's nft tool. The failing check caused script abort due to 'set -e' though. Fix this by running the potentially failing nft command inside the if-conditional pipe.

Fixes 73db1b5dab6f ("selftests: netfilter: Torture nftables netdev hooks")
---
 .../selftests/net/netfilter/nft_interface_stress.sh        | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/net/netfilter/nft_interface_stress.sh +5 -2
index 11d82d11495e..5ff7be9daeee 100755
@@ -97,7 +97,8 @@ kill $nft_monitor_pid
 kill $rename_loop_pid
 wait
 
-ip netns exec $nsr nft -f - <<EOF
+wildcard_prep() {
+	ip netns exec $nsr nft -f - <<EOF
 table ip t {
 	flowtable ft_wild {
 		hook ingress priority 0
@@ -105,7 +106,9 @@ table ip t {
 	}
 }
 EOF
-if [[ $? -ne 0 ]]; then
+}
+
+if ! wildcard_prep; then
 	echo "SKIP wildcard tests: not supported by host's nft?"
 else
 	for ((i = 0; i < 100; i++)); do
Signature · 1 line
2.49.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Phil Sutter

The script is supposed to skip wildcard interface testing if unsupported by the host's nft tool. The failing check caused script abort due to 'set -e' though. Fix this by running the potentially failing nft command inside the if-conditional pipe.

Thanks Phil, this is an easy fix for this.

Quoted 2 lines
Fixes 73db1b5dab6f ("selftests: netfilter: Torture nftables netdev hooks")

Paolo, you can take this now to calm down CI. Thanks

Quoted 32 lines
---
 .../selftests/net/netfilter/nft_interface_stress.sh        | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tools/testing/selftests/net/netfilter/nft_interface_stress.sh +5 -2
index 11d82d11495e..5ff7be9daeee 100755
@@ -97,7 +97,8 @@ kill $nft_monitor_pid
 kill $rename_loop_pid
 wait
 
-ip netns exec $nsr nft -f - <<EOF
+wildcard_prep() {
+	ip netns exec $nsr nft -f - <<EOF
 table ip t {
 	flowtable ft_wild {
 		hook ingress priority 0
@@ -105,7 +106,9 @@ table ip t {
 	}
 }
 EOF
-if [[ $? -ne 0 ]]; then
+}
+
+if ! wildcard_prep; then
 	echo "SKIP wildcard tests: not supported by host's nft?"
 else
 	for ((i = 0; i < 100; i++)); do
Signature · 1 line
2.49.0
maintainer
#2 lore raw
In reply to Phil Sutter
Quoted 7 lines · Phil Sutter

The script is supposed to skip wildcard interface testing if unsupported by the host's nft tool. The failing check caused script abort due to 'set -e' though. Fix this by running the potentially failing nft command inside the if-conditional pipe.

Fixes 73db1b5dab6f ("selftests: netfilter: Torture nftables netdev hooks")

FTR I'm applying this patch below the 24h grace period to avoid sending a net-next PR with known issue and known unapplied fix.

/P

#3 lore raw
In reply to Phil Sutter
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 27 May 2025 11:41:17 +0200 you wrote:

The script is supposed to skip wildcard interface testing if unsupported by the host's nft tool. The failing check caused script abort due to 'set -e' though. Fix this by running the potentially failing nft command inside the if-conditional pipe.

Fixes 73db1b5dab6f ("selftests: netfilter: Torture nftables netdev hooks")

[...]

Here is the summary with links:
- [net-next] selftests: netfilter: Fix skip of wildcard interface test

    https://git.kernel.org/netdev/net-next/c/6da5f1b4b4a0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html