diff mbox series

[nft,3/3] tests: add a test case for map update from packet path with concat

Message ID 20221212100436.84116-4-fw@strlen.de
State Accepted
Delegated to: Florian Westphal
Headers show
Series fix map update with concatenation and timeouts | expand

Commit Message

Florian Westphal Dec. 12, 2022, 10:04 a.m. UTC
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>
---
 .../maps/dumps/typeof_maps_concat_update_0.nft | 12 ++++++++++++
 .../testcases/maps/typeof_maps_concat_update_0 | 18 ++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft
 create mode 100755 tests/shell/testcases/maps/typeof_maps_concat_update_0
diff mbox series

Patch

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
index 000000000000..0963668629e5
--- /dev/null
+++ b/tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft
@@ -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 {
+		meta l4proto tcp update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ct original ip daddr . ct reply proto-src }
+	}
+}
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
index 000000000000..357594ad55e8
--- /dev/null
+++ b/tests/shell/testcases/maps/typeof_maps_concat_update_0
@@ -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 : ct original ip daddr . ct reply proto-src timeout 1m30s }
+  }
+}"
+
+set -e
+$NFT -f - <<< $EXPECTED