]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: Skip netdev_chain_dev_addremove on tainted kernels
authorPhil Sutter <phil@nwl.cc>
Thu, 8 May 2025 10:08:39 +0000 (12:08 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 8 May 2025 21:50:02 +0000 (23:50 +0200)
The test checks taint state to indicate success or failure. Since this
won't work if the kernel is already tainted at start, skip the test
instead of failing it.

Fixes: 02dbf86f39410 ("tests: shell: add a test case for netdev ruleset flush + parallel link down")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/chains/netdev_chain_dev_addremove

index 14260d54b778ef1bdafc71029ec62acb6de3a8fe..6103e82b10603eae36a9ae11ce8e238f084d15db 100755 (executable)
@@ -4,6 +4,12 @@
 
 set -e
 
+read taint < /proc/sys/kernel/tainted
+if [ "$taint" -ne 0 ]; then
+       echo "Kernel already tainted up front."
+       exit 77
+fi
+
 iface_cleanup() {
         ip link del d0 &>/dev/null || :
 }
@@ -26,10 +32,6 @@ EOF
 }
 
 for i in $(seq 1 500);do
-       read taint < /proc/sys/kernel/tainted
-       if [ "$taint" -ne 0 ]; then
-               exit 1
-       fi
        ip link add dummy0 type dummy
        load_rules
 
@@ -37,12 +39,11 @@ for i in $(seq 1 500);do
        $NFT flush ruleset &
        ip link del dummy0 &
        wait
-done
 
-read taint < /proc/sys/kernel/tainted
-
-if [ "$taint" -ne 0 ]; then
-       exit 1
-fi
+       read taint < /proc/sys/kernel/tainted
+       if [ "$taint" -ne 0 ]; then
+               exit 1
+       fi
+done
 
 exit 0