]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/py: Add a test for failing ipsec after counter
authorPhil Sutter <phil@nwl.cc>
Thu, 23 Jun 2022 14:28:42 +0000 (16:28 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 27 Jun 2022 10:21:46 +0000 (12:21 +0200)
This is a bug in parser/scanner due to scoping:

| Error: syntax error, unexpected string, expecting saddr or daddr
| add rule ip ipsec-ip4 ipsec-forw counter ipsec out ip daddr 192.168.1.2
|                                                       ^^^^^

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/py/inet/ipsec.t
tests/py/inet/ipsec.t.json
tests/py/inet/ipsec.t.payload

index e924e9bcbdbc4b0670af5def7ba53f037a7f25cf..b18df395de6ce5c5730fb792a0550eb9eaaf675a 100644 (file)
@@ -19,3 +19,5 @@ ipsec in ip6 daddr dead::beef;ok
 ipsec out ip6 saddr dead::feed;ok
 
 ipsec in spnum 256 reqid 1;fail
+
+counter ipsec out ip daddr 192.168.1.2;ok
index d7d3a03c21131cdd85723338dc0ced5e6c7efc99..18a64f3533b3432eee2e835eed520d78adb9de75 100644 (file)
         }
     }
 ]
+
+# counter ipsec out ip daddr 192.168.1.2
+[
+    {
+        "counter": null
+    },
+    {
+        "match": {
+            "left": {
+                "ipsec": {
+                    "dir": "out",
+                    "family": "ip",
+                    "key": "daddr",
+                    "spnum": 0
+                }
+            },
+            "op": "==",
+            "right": "192.168.1.2"
+        }
+    }
+]
index c46a2263f6c0121c85a27b2f0cf0d570a257712f..9648255df02e9a3f974cf504508bd38e178c5bc1 100644 (file)
@@ -37,3 +37,9 @@ ip ipsec-ip4 ipsec-forw
   [ xfrm load out 0 saddr6 => reg 1 ]
   [ cmp eq reg 1 0x0000adde 0x00000000 0x00000000 0xedfe0000 ]
 
+# counter ipsec out ip daddr 192.168.1.2
+ip ipsec-ip4 ipsec-forw
+  [ counter pkts 0 bytes 0 ]
+  [ xfrm load out 0 daddr4 => reg 1 ]
+  [ cmp eq reg 1 0x0201a8c0 ]
+