From: Pablo Neira Ayuso Date: Wed, 12 Jun 2024 23:20:17 +0000 (+0200) Subject: tests: shell: skip NFTA_RULE_POSITION_ID tests if kernel does not support it X-Git-Tag: v1.1.0~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f82a9a2632323df346815dcb6825bf6ac9040a37;p=thirdparty%2Fnftables.git tests: shell: skip NFTA_RULE_POSITION_ID tests if kernel does not support it Signed-off-by: Pablo Neira Ayuso --- diff --git a/tests/shell/features/position_id.sh b/tests/shell/features/position_id.sh new file mode 100755 index 00000000..43ac97ac --- /dev/null +++ b/tests/shell/features/position_id.sh @@ -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" diff --git a/tests/shell/testcases/cache/0011_index_0 b/tests/shell/testcases/cache/0011_index_0 index c9eb8683..76f2615d 100755 --- a/tests/shell/testcases/cache/0011_index_0 +++ b/tests/shell/testcases/cache/0011_index_0 @@ -1,5 +1,7 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_position_id) + set -e RULESET="flush ruleset diff --git a/tests/shell/testcases/transactions/0024rule_0 b/tests/shell/testcases/transactions/0024rule_0 index 4c1ac41d..645319e2 100755 --- a/tests/shell/testcases/transactions/0024rule_0 +++ b/tests/shell/testcases/transactions/0024rule_0 @@ -1,5 +1,7 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_position_id) + RULESET="flush ruleset add table x add chain x y