Blame SOURCES/0024-tests-add-a-test-case-for-map-update-from-packet-pat.patch

b59ec1
From 1bbcacb6445bda10aa0a82b12329116b56ea44e3 Mon Sep 17 00:00:00 2001
b59ec1
From: Phil Sutter <psutter@redhat.com>
b59ec1
Date: Fri, 17 Feb 2023 17:52:16 +0100
b59ec1
Subject: [PATCH] tests: add a test case for map update from packet path with
b59ec1
 concat
b59ec1
b59ec1
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2094894
b59ec1
Upstream Status: nftables commit b8e1940aa1907
b59ec1
b59ec1
commit b8e1940aa190773b23b3ee9349beb20c31f42bdb
b59ec1
Author: Florian Westphal <fw@strlen.de>
b59ec1
Date:   Mon Dec 12 11:04:36 2022 +0100
b59ec1
b59ec1
    tests: add a test case for map update from packet path with concat
b59ec1
b59ec1
    add a second test case for map updates, this time with both
b59ec1
    a timeout and a data element that consists of a concatenation.
b59ec1
b59ec1
    Signed-off-by: Florian Westphal <fw@strlen.de>
b59ec1
b59ec1
Signed-off-by: Phil Sutter <psutter@redhat.com>
b59ec1
---
b59ec1
 .../maps/dumps/typeof_maps_concat_update_0.nft | 12 ++++++++++++
b59ec1
 .../testcases/maps/typeof_maps_concat_update_0 | 18 ++++++++++++++++++
b59ec1
 2 files changed, 30 insertions(+)
b59ec1
 create mode 100644 tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft
b59ec1
 create mode 100755 tests/shell/testcases/maps/typeof_maps_concat_update_0
b59ec1
b59ec1
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
b59ec1
new file mode 100644
b59ec1
index 0000000..d91b795
b59ec1
--- /dev/null
b59ec1
+++ b/tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft
b59ec1
@@ -0,0 +1,12 @@
b59ec1
+table ip foo {
b59ec1
+	map pinned {
b59ec1
+		typeof ip daddr . tcp dport : ip daddr . tcp dport
b59ec1
+		size 65535
b59ec1
+		flags dynamic,timeout
b59ec1
+		timeout 6m
b59ec1
+	}
b59ec1
+
b59ec1
+	chain pr {
b59ec1
+		update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport }
b59ec1
+	}
b59ec1
+}
b59ec1
diff --git a/tests/shell/testcases/maps/typeof_maps_concat_update_0 b/tests/shell/testcases/maps/typeof_maps_concat_update_0
b59ec1
new file mode 100755
b59ec1
index 0000000..645ae14
b59ec1
--- /dev/null
b59ec1
+++ b/tests/shell/testcases/maps/typeof_maps_concat_update_0
b59ec1
@@ -0,0 +1,18 @@
b59ec1
+#!/bin/bash
b59ec1
+
b59ec1
+# check update statement does print both concatentations (key and data).
b59ec1
+
b59ec1
+EXPECTED="table ip foo {
b59ec1
+ map pinned {
b59ec1
+	typeof ip daddr . tcp dport : ip daddr . tcp dport
b59ec1
+	size 65535
b59ec1
+	flags dynamic,timeout
b59ec1
+        timeout 6m
b59ec1
+  }
b59ec1
+  chain pr {
b59ec1
+     meta l4proto tcp update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport }
b59ec1
+  }
b59ec1
+}"
b59ec1
+
b59ec1
+set -e
b59ec1
+$NFT -f - <<< $EXPECTED
b59ec1
-- 
b59ec1
2.39.2
b59ec1