]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: test jump to basechain is rejected, even if there is no loop
authorFlorian Westphal <fw@strlen.de>
Wed, 10 Jul 2024 21:02:08 +0000 (23:02 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 11 Jul 2024 15:05:28 +0000 (17:05 +0200)
Check that we can't jump to input hook from output.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/chains/jump_to_base_chain [new file with mode: 0755]

diff --git a/tests/shell/testcases/chains/jump_to_base_chain b/tests/shell/testcases/chains/jump_to_base_chain
new file mode 100755 (executable)
index 0000000..d71da4c
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+$NFT -f - <<EOF
+table t {
+       chain i {
+               type filter hook input priority 0
+       }
+
+       chain o {
+               type filter hook output priority 0
+               jump c
+       }
+
+       chain c {
+               jump i
+       }
+}
+EOF
+
+if [ $? -eq 0 ];then
+       echo "E: Accepted jump to a base chain"
+       exit 1
+fi
+
+exit 0