]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: add testcases for comments in set elements
authorArturo Borrero Gonzalez <arturo@debian.org>
Wed, 9 Nov 2016 09:38:26 +0000 (10:38 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 9 Nov 2016 19:03:54 +0000 (20:03 +0100)
This patch adds a several testcases for comments in set elements.
This includes the netfilter bug #1090 about comments in set interval elements.

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/sets/0008comments_interval_0 [new file with mode: 0755]
tests/shell/testcases/sets/0009comments_timeout_0 [new file with mode: 0755]
tests/shell/testcases/sets/0010comments_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/sets/0008comments_interval_0 b/tests/shell/testcases/sets/0008comments_interval_0
new file mode 100755 (executable)
index 0000000..98c709c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# This test netfilter bug #1090
+# https://bugzilla.netfilter.org/show_bug.cgi?id=1090
+
+$NFT add table t
+$NFT add set t s {type ipv4_addr \; flags interval \;}
+$NFT add element t s { 1.1.1.1 comment "test" }
+if ! $NFT list ruleset | grep test >/dev/null ; then
+       echo "E: missing comment in set element" >&2
+       exit 1
+fi
diff --git a/tests/shell/testcases/sets/0009comments_timeout_0 b/tests/shell/testcases/sets/0009comments_timeout_0
new file mode 100755 (executable)
index 0000000..4e3f80c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Test that comments are added to set elements in timemout sets.
+
+$NFT flush ruleset
+$NFT add table t
+$NFT add set t s {type ipv4_addr \; flags timeout \;}
+$NFT add element t s { 1.1.1.1 comment "test" }
+if ! $NFT list ruleset | grep test >/dev/null ; then
+       echo "E: missing comment in set element" >&2
+       exit 1
+fi
diff --git a/tests/shell/testcases/sets/0010comments_0 b/tests/shell/testcases/sets/0010comments_0
new file mode 100755 (executable)
index 0000000..4467a3b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Test that comments are added to set elements in standard sets.
+
+$NFT add table inet t
+$NFT add set inet t s {type ipv6_addr \; }
+$NFT add element inet t s { ::1 comment "test" }
+if ! $NFT list ruleset | grep test >/dev/null ; then
+       echo "E: missing comment in set element" >&2
+       exit 1
+fi