summaryrefslogtreecommitdiffstats
path: root/tests/shell/features/reset_set.sh
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2023-09-18 12:28:26 +0200
committerFlorian Westphal <fw@strlen.de>2023-09-18 13:08:57 +0200
commit5f83041242ca0ff38a74d51b85e00047568c4933 (patch)
tree15c625ba17b2a5c6281c35c9468ef9f2edf514fa /tests/shell/features/reset_set.sh
parent45060a09bc3ad1c4bcfd4ad91863e00ab58efb5b (diff)
tests/shell: skip reset tests if kernel lacks support
reset is implemented via flush + extra attribute, so older kernels perform a flush. This means .nft doesn't work, we need to check if the individual set contents/sets are still in place post-reset. Make this generic and permit use of feat.sh in addition to the simpler foo.nft feature files. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'tests/shell/features/reset_set.sh')
-rwxr-xr-xtests/shell/features/reset_set.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/shell/features/reset_set.sh b/tests/shell/features/reset_set.sh
new file mode 100755
index 00000000..3d034175
--- /dev/null
+++ b/tests/shell/features/reset_set.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# 079cd633219d ("netfilter: nf_tables: Introduce NFT_MSG_GETSETELEM_RESET")
+# v6.5-rc1~163^2~9^2~1
+
+unshare -n bash -c "$NFT add table t; \
+ $NFT add set t s { type ipv4_addr\; counter\; elements = { 127.0.0.1 counter packets 1 bytes 2 } } ; \
+ $NFT reset set t s ; \
+ $NFT reset set t s | grep counter\ packets\ 0\ bytes\ 0
+"