Blame SOURCES/0007-tests-py-Add-a-test-for-failing-ipsec-after-counter.patch

1d03cd
From 39c0d8ee8c8b0a667fc1c20336b3d248d28759f3 Mon Sep 17 00:00:00 2001
1d03cd
From: Phil Sutter <psutter@redhat.com>
1d03cd
Date: Thu, 9 Feb 2023 10:18:10 +0100
1d03cd
Subject: [PATCH] tests/py: Add a test for failing ipsec after counter
1d03cd
1d03cd
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2113874
1d03cd
Upstream Status: nftables commit ed2426bccd3ea
1d03cd
1d03cd
commit ed2426bccd3ea954adc8a010bf1736e8ed6a81b9
1d03cd
Author: Phil Sutter <phil@nwl.cc>
1d03cd
Date:   Thu Jun 23 16:28:42 2022 +0200
1d03cd
1d03cd
    tests/py: Add a test for failing ipsec after counter
1d03cd
1d03cd
    This is a bug in parser/scanner due to scoping:
1d03cd
1d03cd
    | Error: syntax error, unexpected string, expecting saddr or daddr
1d03cd
    | add rule ip ipsec-ip4 ipsec-forw counter ipsec out ip daddr 192.168.1.2
1d03cd
    |                                                       ^^^^^
1d03cd
1d03cd
    Signed-off-by: Phil Sutter <phil@nwl.cc>
1d03cd
    Signed-off-by: Florian Westphal <fw@strlen.de>
1d03cd
1d03cd
Signed-off-by: Phil Sutter <psutter@redhat.com>
1d03cd
---
1d03cd
 tests/py/inet/ipsec.t         |  2 ++
1d03cd
 tests/py/inet/ipsec.t.json    | 21 +++++++++++++++++++++
1d03cd
 tests/py/inet/ipsec.t.payload |  6 ++++++
1d03cd
 3 files changed, 29 insertions(+)
1d03cd
1d03cd
diff --git a/tests/py/inet/ipsec.t b/tests/py/inet/ipsec.t
1d03cd
index e924e9b..b18df39 100644
1d03cd
--- a/tests/py/inet/ipsec.t
1d03cd
+++ b/tests/py/inet/ipsec.t
1d03cd
@@ -19,3 +19,5 @@ ipsec in ip6 daddr dead::beef;ok
1d03cd
 ipsec out ip6 saddr dead::feed;ok
1d03cd
 
1d03cd
 ipsec in spnum 256 reqid 1;fail
1d03cd
+
1d03cd
+counter ipsec out ip daddr 192.168.1.2;ok
1d03cd
diff --git a/tests/py/inet/ipsec.t.json b/tests/py/inet/ipsec.t.json
1d03cd
index d7d3a03..18a64f3 100644
1d03cd
--- a/tests/py/inet/ipsec.t.json
1d03cd
+++ b/tests/py/inet/ipsec.t.json
1d03cd
@@ -134,3 +134,24 @@
1d03cd
         }
1d03cd
     }
1d03cd
 ]
1d03cd
+
1d03cd
+# counter ipsec out ip daddr 192.168.1.2
1d03cd
+[
1d03cd
+    {
1d03cd
+        "counter": null
1d03cd
+    },
1d03cd
+    {
1d03cd
+        "match": {
1d03cd
+            "left": {
1d03cd
+                "ipsec": {
1d03cd
+                    "dir": "out",
1d03cd
+                    "family": "ip",
1d03cd
+                    "key": "daddr",
1d03cd
+                    "spnum": 0
1d03cd
+                }
1d03cd
+            },
1d03cd
+            "op": "==",
1d03cd
+            "right": "192.168.1.2"
1d03cd
+        }
1d03cd
+    }
1d03cd
+]
1d03cd
diff --git a/tests/py/inet/ipsec.t.payload b/tests/py/inet/ipsec.t.payload
1d03cd
index c46a226..9648255 100644
1d03cd
--- a/tests/py/inet/ipsec.t.payload
1d03cd
+++ b/tests/py/inet/ipsec.t.payload
1d03cd
@@ -37,3 +37,9 @@ ip ipsec-ip4 ipsec-forw
1d03cd
   [ xfrm load out 0 saddr6 => reg 1 ]
1d03cd
   [ cmp eq reg 1 0x0000adde 0x00000000 0x00000000 0xedfe0000 ]
1d03cd
 
1d03cd
+# counter ipsec out ip daddr 192.168.1.2
1d03cd
+ip ipsec-ip4 ipsec-forw
1d03cd
+  [ counter pkts 0 bytes 0 ]
1d03cd
+  [ xfrm load out 0 daddr4 => reg 1 ]
1d03cd
+  [ cmp eq reg 1 0x0201a8c0 ]
1d03cd
+
1d03cd
-- 
1d03cd
2.39.1
1d03cd