]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add test case for sets updated from packet path
authorFlorian Westphal <fw@strlen.de>
Tue, 13 Feb 2018 14:28:00 +0000 (15:28 +0100)
committerFlorian Westphal <fw@strlen.de>
Wed, 14 Feb 2018 17:50:17 +0000 (18:50 +0100)
currently kernel may pick a set implementation that doesn't provide
a ->update() function. This causes an error when user attempts to
add the nftables rule that is supposed to add entries to the set.

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

diff --git a/tests/shell/testcases/sets/0028autoselect_0 b/tests/shell/testcases/sets/0028autoselect_0
new file mode 100755 (executable)
index 0000000..fdda832
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# This testscase checks kernel picks a suitable set backends.
+# Ruleset attempts to update from packet path, so set backend
+# needs an ->update() implementation.
+
+set -e
+
+$NFT add table t
+$NFT add set t s1 { type inet_proto \; }
+$NFT add set t s2 { type ipv4_addr \; }
+$NFT add set t s3 { type ipv4_addr \; size 1024\; }
+$NFT add chain t c {type filter hook input priority 0 \; }
+
+$NFT add rule t c meta iifname foobar set add ip protocol @s1
+$NFT add rule t c meta iifname foobar set add ip daddr @s2
+$NFT add rule t c meta iifname foobar set add ip daddr @s3