]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: check that rule add with index works with echo
authorEric Garver <eric@garver.life>
Fri, 6 Sep 2019 00:33:02 +0000 (20:33 -0400)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 6 Sep 2019 00:35:50 +0000 (02:35 +0200)
Signed-off-by: Eric Garver <eric@garver.life>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/cache/0007_echo_cache_init_0 [new file with mode: 0755]
tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft [new file with mode: 0644]

diff --git a/tests/shell/testcases/cache/0007_echo_cache_init_0 b/tests/shell/testcases/cache/0007_echo_cache_init_0
new file mode 100755 (executable)
index 0000000..280a0d0
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+$NFT -i >/dev/null <<EOF
+add table inet t
+add chain inet t c
+add rule inet t c accept comment "first"
+add rule inet t c accept comment "third"
+EOF
+
+# make sure the rule cache gets initialized when using echo option
+#
+$NFT --echo add rule inet t c index 0 accept comment '"second"' >/dev/null
diff --git a/tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft b/tests/shell/testcases/cache/dumps/0007_echo_cache_init_0.nft
new file mode 100644 (file)
index 0000000..c774ee7
--- /dev/null
@@ -0,0 +1,7 @@
+table inet t {
+       chain c {
+               accept comment "first"
+               accept comment "second"
+               accept comment "third"
+       }
+}