Skip to contentSkip to conversation

tests: shell: set reference from variable definition

PATCH In review Pablo Neira Ayuso 2 participants 2 messages Nov 18, 2019 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 tests: shell: set reference from variable definition

Allow to define variable using set reference, eg.

define x = @z

---
 tests/shell/testcases/nft-f/0022variables_0 | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 tests/shell/testcases/nft-f/0022variables_0
tests/shell/testcases/nft-f/0022variables_0 new file +21 -0
new file mode 100755
index 000000000000..ee17a6272aa3
@@ -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"
Signature · 1 line
2.11.0