]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: skip NFTA_RULE_POSITION_ID tests if kernel does not support it
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 12 Jun 2024 23:20:17 +0000 (01:20 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 13 Jun 2024 00:26:49 +0000 (02:26 +0200)
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/features/position_id.sh [new file with mode: 0755]
tests/shell/testcases/cache/0011_index_0
tests/shell/testcases/transactions/0024rule_0

diff --git a/tests/shell/features/position_id.sh b/tests/shell/features/position_id.sh
new file mode 100755 (executable)
index 0000000..43ac97a
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# 75dd48e2e420 ("netfilter: nf_tables: Support RULE_ID reference in new rule")
+# v5.1-rc1~178^2~405^2~27
+
+EXPECTED="table inet t {
+       chain c {
+               tcp dport 1234 accept
+               udp dport 4321 accept
+               accept
+       }
+}"
+
+RULESET="add table inet t
+add chain inet t c
+add rule inet t c tcp dport 1234 accept
+add rule inet t c accept
+insert rule inet t c index 1 udp dport 4321 accept
+"
+
+$NFT -f - <<< $RULESET
+
+diff -u <($NFT list ruleset) - <<<"$EXPECTED"
index c9eb86830c8d7abf0a1a4fa1e2beb04eb31e17af..76f2615d471c836e8c5d042562839c1706347369 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_position_id)
+
 set -e
 
 RULESET="flush ruleset
index 4c1ac41db3b471c925ee2b38b958bb7456088f1f..645319e271946990e9ccdf5ff4e7cae4761e8b56 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_position_id)
+
 RULESET="flush ruleset
 add table x
 add chain x y