]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: shell: set reference from variable definition
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 18 Nov 2019 14:38:25 +0000 (15:38 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 18 Nov 2019 14:39:47 +0000 (15:39 +0100)
Allow to define variable using set reference, eg.

define x = @z

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/shell/testcases/nft-f/0022variables_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/nft-f/0022variables_0 b/tests/shell/testcases/nft-f/0022variables_0
new file mode 100755 (executable)
index 0000000..ee17a62
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+RULESET="define test1 = @y
+
+table ip x {
+       set y {
+               type ipv4_addr
+               flags dynamic,timeout
+       }
+
+       chain z {
+               type filter hook input priority filter; policy accept;
+               add \$test1 { ip saddr }
+               update \$test1 { ip saddr timeout 30s }
+               ip saddr \$test1
+       }
+}"
+
+$NFT -f - <<< "$RULESET"