]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: add test case for catchall gc bug
authorFlorian Westphal <fw@strlen.de>
Mon, 6 Nov 2023 09:51:44 +0000 (10:51 +0100)
committerFlorian Westphal <fw@strlen.de>
Tue, 28 Nov 2023 19:00:43 +0000 (20:00 +0100)
Check for bug fixed with kernel
commit 93995bf4af2c ("netfilter: nf_tables: remove catchall element in GC sync path").

Reported-by: lonial con <kongln9170@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/maps/map_catchall_double_free [new file with mode: 0755]

diff --git a/tests/shell/testcases/maps/map_catchall_double_free b/tests/shell/testcases/maps/map_catchall_double_free
new file mode 100755 (executable)
index 0000000..d101256
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element)
+
+$NFT "add table ip test ;
+     add map ip test testmap { type ipv4_addr . ipv4_addr: verdict; flags interval,timeout; timeout 1s;};
+     add chain ip test testchain;
+     add element ip test testmap { * : jump testchain }" || exit 1
+
+sleep 2
+$NFT "add element ip test testmap { 1.2.3.4 . 5.6.7.8: jump testchain }" || exit 1
+sleep 2
+$NFT "add element ip test testmap { 2.3.4.5 . 6.7.8.9 timeout 1m: jump testchain }" || exit 1