]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: add a test case for map update from packet path with concat
authorFlorian Westphal <fw@strlen.de>
Mon, 12 Dec 2022 10:04:36 +0000 (11:04 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 12 Dec 2022 16:41:01 +0000 (17:41 +0100)
add a second test case for map updates, this time with both
a timeout and a data element that consists of a concatenation.

Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft [new file with mode: 0644]
tests/shell/testcases/maps/typeof_maps_concat_update_0 [new file with mode: 0755]

diff --git a/tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft b/tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft
new file mode 100644 (file)
index 0000000..d91b795
--- /dev/null
@@ -0,0 +1,12 @@
+table ip foo {
+       map pinned {
+               typeof ip daddr . tcp dport : ip daddr . tcp dport
+               size 65535
+               flags dynamic,timeout
+               timeout 6m
+       }
+
+       chain pr {
+               update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport }
+       }
+}
diff --git a/tests/shell/testcases/maps/typeof_maps_concat_update_0 b/tests/shell/testcases/maps/typeof_maps_concat_update_0
new file mode 100755 (executable)
index 0000000..645ae14
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# check update statement does print both concatentations (key and data).
+
+EXPECTED="table ip foo {
+ map pinned {
+       typeof ip daddr . tcp dport : ip daddr . tcp dport
+       size 65535
+       flags dynamic,timeout
+        timeout 6m
+  }
+  chain pr {
+     meta l4proto tcp update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport }
+  }
+}"
+
+set -e
+$NFT -f - <<< $EXPECTED