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

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