Skip to contentSkip to conversation

tests/py: Write dissenting payload into the right file

PATCH New Phil Sutter 1 participant 2 messages Feb 3, 2021 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/2 tests/py: Write dissenting payload into the right file

The testsuite supports diverging payloads depending on table family. This is necessary since for some families, dependency matches are created.
If a payload mismatch happens, record it into a "got"-file which matches the family-specific payload file, not the common one. This eases use of diff-tools a lot as the extra other families' payloads confuse the tools.

---
 tests/py/nft-test.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/py/nft-test.py +4 -1
index 7ca5a22a16fbf..18e9c67fa26be 100755
@@ -712,8 +712,10 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path):
 
     if rule[1].strip() == "ok":
         payload_expected = None
+        payload_path = None
         try:
             payload_log = open("%s.payload" % filename_path)
+            payload_path = payload_log.name
             payload_expected = payload_find_expected(payload_log, rule[0])
         except:
             payload_log = None
@@ -756,6 +758,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path):
             table_payload_expected = None
             try:
                 payload_log = open("%s.payload.%s" % (filename_path, table.family))
+                payload_path = payload_log.name
                 table_payload_expected = payload_find_expected(payload_log, rule[0])
             except:
                 if not payload_log:
@@ -802,7 +805,7 @@ def rule_add(rule, filename, lineno, force_all_family_option, filename_path):
             if state == "ok" and not payload_check(table_payload_expected,
                                                    payload_log, cmd):
                 error += 1
-                gotf = open("%s.payload.got" % filename_path, 'a')
+                gotf = open("%s.got" % payload_path, 'a')
                 payload_log.seek(0, 0)
                 gotf.write("# %s\n" % rule[0])
                 while True:
Signature · 1 line
2.28.0
author reviewer
#1 lore raw

PATCH 2/2 tests/py: Add a test sanitizer and fix its findings

This is just basic housekeeping:

- Remove duplicate tests in any of the *.t files
- Remove explicit output if equal to command itself in *.t files
- Remove duplicate payload records in any of the *.t.payload* files
- Remove stale payload records (for which no commands exist in the respective *.t file
- Remove duplicate/stale entries in any of the *.t.json files

In some cases, tests were added instead of removing a stale payload record if it fit nicely into the sequence of tests.

---
 tests/py/any/ct.t                    |   1 +
 tests/py/any/ct.t.json               |  56 +++----
 tests/py/any/ct.t.payload            |   9 --
 tests/py/any/meta.t                  |  34 ++--
 tests/py/any/meta.t.payload          |  44 ------
 tests/py/any/tcpopt.t                |   1 -
 tests/py/arp/arp.t                   |   2 -
 tests/py/arp/arp.t.json              |  32 ----
 tests/py/arp/arp.t.payload           |  10 --
 tests/py/arp/arp.t.payload.netdev    |  14 --
 tests/py/inet/ah.t                   |   2 -
 tests/py/inet/dccp.t.json            |  18 ---
 tests/py/inet/dccp.t.payload         |   8 -
 tests/py/inet/esp.t                  |   1 +
 tests/py/inet/esp.t.json             |  20 +++
 tests/py/inet/ether.t.payload.bridge |  21 ---
 tests/py/inet/ether.t.payload.ip     |  23 ---
 tests/py/inet/reject.t.payload.inet  | 104 ------------
 tests/py/inet/rt.t                   |   5 +-
 tests/py/inet/sets.t.payload.netdev  |   2 +-
 tests/py/inet/synproxy.t.json        |  32 ----
 tests/py/ip/icmp.t.payload.ip        |  11 --
 tests/py/ip/igmp.t.payload           | 228 ---------------------------
 tests/py/ip/ip.t                     |   4 +-
 tests/py/ip/ip.t.payload             |  10 --
 tests/py/ip/ip.t.payload.inet        |  12 --
 tests/py/ip/ip.t.payload.netdev      | 112 -------------
 tests/py/ip6/dnat.t                  |   2 +-
 tests/py/ip6/ether.t                 |   2 +-
 tests/py/ip6/frag.t.payload.inet     |   8 -
 tests/py/ip6/frag.t.payload.ip6      |   6 -
 tests/py/ip6/icmpv6.t                |   2 +-
 tests/py/ip6/icmpv6.t.json           |  11 +-
 tests/py/ip6/icmpv6.t.payload.ip6    |   7 +-
 tests/py/ip6/ip6.t                   |   2 +-
 tests/py/ip6/ip6.t.payload.inet      |   2 +-
 tests/py/ip6/ip6.t.payload.ip6       |   2 +-
 tests/py/ip6/snat.t                  |   2 +-
 tests/py/tools/test-sanitizer.sh     |  78 +++++++++
 39 files changed, 160 insertions(+), 780 deletions(-)
 create mode 100755 tests/py/tools/test-sanitizer.sh
tests/py/any/ct.t +1 -0
index cc09aebcbc448..0ec027f55c237 100644
@@ -26,6 +26,7 @@ ct status != expected;ok
 ct status seen-reply;ok
 ct status != seen-reply;ok
 ct status {expected, seen-reply, assured, confirmed, dying};ok
+ct status != {expected, seen-reply, assured, confirmed, dying};ok
 ct status expected,seen-reply,assured,confirmed,snat,dnat,dying;ok
 ct status snat;ok
 ct status dnat;ok
tests/py/any/ct.t.json +23 -33

68 lines not on this page · raw message

tests/py/any/ct.t.payload +0 -9
index 51a8250349015..9223201f576d0 100644
@@ -306,15 +306,6 @@ ip test-ip4 output
   [ ct load helper => reg 1 ]
   [ cmp eq reg 1 0x00707466 0x00000000 0x00000000 0x00000000 ]
 
-# ct state . ct mark { new . 0x12345678}
-__set%d test 3
-__set%d test 0
-	element 00000008 12345678  : 0 [end]
-ip test-ip4 output
-  [ ct load state => reg 1 ]
-  [ ct load mark => reg 9 ]
-  [ lookup reg 1 set __set%d ]
-
 # ct state . ct mark { new . 0x12345678, new . 0x34127856, established . 0x12785634}
 __set%d test-ip4 3
 __set%d test-ip4 0
tests/py/any/meta.t +17 -17
index 327f973f1bd5a..7b5825051c8af 100644
@@ -29,7 +29,7 @@ meta l4proto 22;ok
 meta l4proto != 233;ok
 meta l4proto 33-45;ok
 meta l4proto != 33-45;ok
-meta l4proto { 33, 55, 67, 88};ok;meta l4proto { 33, 55, 67, 88}
+meta l4proto { 33, 55, 67, 88};ok
 meta l4proto != { 33, 55, 67, 88};ok
 meta l4proto { 33-55, 66-88};ok
 meta l4proto != { 33-55, 66-88};ok
@@ -101,10 +101,10 @@ meta skuid != "root";ok;meta skuid != 0
 meta skuid lt 3000 accept;ok;meta skuid < 3000 accept
 meta skuid gt 3000 accept;ok;meta skuid > 3000 accept
 meta skuid eq 3000 accept;ok;meta skuid 3000 accept
-meta skuid 3001-3005 accept;ok;meta skuid 3001-3005 accept
-meta skuid != 2001-2005 accept;ok;meta skuid != 2001-2005 accept
-meta skuid { 2001-2005, 3001-3005} accept;ok;meta skuid { 2001-2005, 3001-3005} accept
-meta skuid != { 2001-2005, 3001-3005} accept;ok;meta skuid != { 2001-2005, 3001-3005} accept
+meta skuid 3001-3005 accept;ok
+meta skuid != 2001-2005 accept;ok
+meta skuid { 2001-2005, 3001-3005} accept;ok
+meta skuid != { 2001-2005, 3001-3005} accept;ok
 
 meta skgid {"bin", "root", "daemon"} accept;ok;meta skgid { 0, 1, 2} accept
 meta skgid != {"bin", "root", "daemon"} accept;ok;meta skgid != { 1, 0, 2} accept
@@ -113,10 +113,10 @@ meta skgid != "root";ok;meta skgid != 0
 meta skgid lt 3000 accept;ok;meta skgid < 3000 accept
 meta skgid gt 3000 accept;ok;meta skgid > 3000 accept
 meta skgid eq 3000 accept;ok;meta skgid 3000 accept
-meta skgid 2001-2005 accept;ok;meta skgid 2001-2005 accept
-meta skgid != 2001-2005 accept;ok;meta skgid != 2001-2005 accept
-meta skgid { 2001-2005} accept;ok;meta skgid { 2001-2005} accept
-meta skgid != { 2001-2005} accept;ok;meta skgid != { 2001-2005} accept
+meta skgid 2001-2005 accept;ok
+meta skgid != 2001-2005 accept;ok
+meta skgid { 2001-2005} accept;ok
+meta skgid != { 2001-2005} accept;ok
 
 # BUG: meta nftrace 2 and meta nftrace 1
 # $ sudo nft add rule ip test input meta nftrace 2
@@ -188,14 +188,14 @@ meta oifgroup {11-33, 44-55};ok;oifgroup {11-33, 44-55}
 meta oifgroup != { 11,33};ok;oifgroup != { 11,33}
 meta oifgroup != {11-33, 44-55};ok;oifgroup != {11-33, 44-55}
 
-meta cgroup 1048577;ok;meta cgroup 1048577
-meta cgroup != 1048577;ok;meta cgroup != 1048577
-meta cgroup { 1048577, 1048578 };ok;meta cgroup { 1048577, 1048578}
-meta cgroup != { 1048577, 1048578};ok;meta cgroup != { 1048577, 1048578}
-meta cgroup 1048577-1048578;ok;meta cgroup 1048577-1048578
-meta cgroup != 1048577-1048578;ok;meta cgroup != 1048577-1048578
-meta cgroup {1048577-1048578};ok;meta cgroup { 1048577-1048578}
-meta cgroup != { 1048577-1048578};ok;meta cgroup != { 1048577-1048578}
+meta cgroup 1048577;ok
+meta cgroup != 1048577;ok
+meta cgroup { 1048577, 1048578 };ok
+meta cgroup != { 1048577, 1048578};ok
+meta cgroup 1048577-1048578;ok
+meta cgroup != 1048577-1048578;ok
+meta cgroup {1048577-1048578};ok
+meta cgroup != { 1048577-1048578};ok
 
 meta iif . meta oif { "lo" . "lo" };ok;iif . oif { "lo" . "lo" }
 meta iif . meta oif . meta mark { "lo" . "lo" . 0x0000000a };ok;iif . oif . meta mark { "lo" . "lo" . 0x0000000a }
tests/py/any/meta.t.payload +0 -44

56 lines not on this page · raw message

tests/py/any/tcpopt.t +0 -1
index e759ac6132d91..f17a20b594926 100644
@@ -37,7 +37,6 @@ tcp option foobar;fail
 tcp option foo bar;fail
 tcp option eol left;fail
 tcp option eol left 1;fail
-tcp option eol left 1;fail
 tcp option sack window;fail
 tcp option sack window 1;fail
 tcp option 256 exists;fail
tests/py/arp/arp.t +0 -2
index 109d01d7ad506..2eee78381599c 100644
@@ -46,7 +46,6 @@ arp operation rreply;ok
 arp operation inrequest;ok
 arp operation inreply;ok
 arp operation nak;ok
-arp operation reply;ok
 arp operation != request;ok
 arp operation != reply;ok
 arp operation != rrequest;ok
@@ -54,7 +53,6 @@ arp operation != rreply;ok
 arp operation != inrequest;ok
 arp operation != inreply;ok
 arp operation != nak;ok
-arp operation != reply;ok
 
 arp saddr ip 1.2.3.4;ok
 arp daddr ip 4.3.2.1;ok
tests/py/arp/arp.t.json +0 -32
index 8508c1703475b..73224f7e185ec 100644
@@ -693,22 +693,6 @@
     }
 ]
 
-# arp operation reply
-[
-    {
-        "match": {
-            "left": {
-                "payload": {
-                    "field": "operation",
-                    "protocol": "arp"
-                }
-            },
-	    "op": "==",
-            "right": "reply"
-        }
-    }
-]
-
 # arp operation != request
 [
     {
@@ -821,22 +805,6 @@
     }
 ]
 
-# arp operation != reply
-[
-    {
-        "match": {
-            "left": {
-                "payload": {
-                    "field": "operation",
-                    "protocol": "arp"
-                }
-            },
-            "op": "!=",
-            "right": "reply"
-        }
-    }
-]
-
 # arp saddr ip 1.2.3.4
 [
     {
tests/py/arp/arp.t.payload +0 -10
index f819853f448ed..a95c834eff5a2 100644
@@ -229,11 +229,6 @@ arp test-arp input
   [ payload load 2b @ network header + 6 => reg 1 ]
   [ cmp eq reg 1 0x00000a00 ]
 
-# arp operation reply
-arp test-arp input
-  [ payload load 2b @ network header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x00000200 ]
-
 # arp operation != request
 arp test-arp input
   [ payload load 2b @ network header + 6 => reg 1 ]
@@ -269,11 +264,6 @@ arp test-arp input
   [ payload load 2b @ network header + 6 => reg 1 ]
   [ cmp neq reg 1 0x00000a00 ]
 
-# arp operation != reply
-arp test-arp input
-  [ payload load 2b @ network header + 6 => reg 1 ]
-  [ cmp neq reg 1 0x00000200 ]
-
 # meta iifname "invalid" arp ptype 0x0800 arp htype 1 arp hlen 6 arp plen 4 @nh,192,32 0xc0a88f10 @nh,144,48 set 0x112233445566
 arp test-arp input
   [ meta load iifname => reg 1 ]
tests/py/arp/arp.t.payload.netdev +0 -14
index f57610cf92f71..ac985a9a794e4 100644
@@ -303,13 +303,6 @@ netdev test-netdev ingress
   [ payload load 2b @ network header + 6 => reg 1 ]
   [ cmp eq reg 1 0x00000a00 ]
 
-# arp operation reply
-netdev test-netdev ingress 
-  [ meta load protocol => reg 1 ]
-  [ cmp eq reg 1 0x00000608 ]
-  [ payload load 2b @ network header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x00000200 ]
-
 # arp operation != request
 netdev test-netdev ingress 
   [ meta load protocol => reg 1 ]
@@ -359,13 +352,6 @@ netdev test-netdev ingress
   [ payload load 2b @ network header + 6 => reg 1 ]
   [ cmp neq reg 1 0x00000a00 ]
 
-# arp operation != reply
-netdev test-netdev ingress 
-  [ meta load protocol => reg 1 ]
-  [ cmp eq reg 1 0x00000608 ]
-  [ payload load 2b @ network header + 6 => reg 1 ]
-  [ cmp neq reg 1 0x00000200 ]
-
 # meta iifname "invalid" arp ptype 0x0800 arp htype 1 arp hlen 6 arp plen 4 @nh,192,32 0xc0a88f10 @nh,144,48 set 0x112233445566
 netdev test-netdev ingress
   [ meta load iifname => reg 1 ]
tests/py/inet/ah.t +0 -2
index 8544d9dd3f47d..945db99621ffe 100644
@@ -6,8 +6,6 @@
 *inet;test-inet;input
 *netdev;test-netdev;ingress
 
-# nexthdr Bug to list table.
-
 - ah nexthdr esp;ok
 - ah nexthdr ah;ok
 - ah nexthdr comp;ok
tests/py/inet/dccp.t.json +0 -18
index 9260fbc5ee00f..97e33c141035d 100644
@@ -98,24 +98,6 @@
     }
 ]
 
-# dccp sport ftp-data - re-mail-ck
-[
-    {
-        "match": {
-            "left": {
-                "payload": {
-                    "field": "sport",
-                    "protocol": "dccp"
-                }
-            },
-	    "op": "==",
-            "right": {
-                "range": [ "ftp-data", "re-mail-ck" ]
-            }
-        }
-    }
-]
-
 # dccp sport 20-50
 [
     {
tests/py/inet/dccp.t.payload +0 -8
index b830aa4f3e648..b252d8294468c 100644
@@ -43,14 +43,6 @@ inet test-inet input
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
 
-# dccp sport ftp-data - re-mail-ck
-inet test-inet input
-  [ meta load l4proto => reg 1 ]
-  [ cmp eq reg 1 0x00000021 ]
-  [ payload load 2b @ transport header + 0 => reg 1 ]
-  [ cmp gte reg 1 0x00001400 ]
-  [ cmp lte reg 1 0x00003200 ]
-
 # dccp sport 20-50
 inet test-inet input
   [ meta load l4proto => reg 1 ]
tests/py/inet/esp.t +1 -0
index e79eeada71849..ebba7d87395e5 100644
@@ -13,6 +13,7 @@ esp spi != 111-222;ok
 esp spi { 100, 102};ok
 esp spi != { 100, 102};ok
 esp spi { 100-102};ok
+esp spi != { 100-102};ok
 - esp spi {100-102};ok
 
 esp sequence 22;ok
tests/py/inet/esp.t.json +20 -0
index 84ea9eeaf2fdf..ee690f96a2d4e 100644
@@ -128,6 +128,26 @@
     }
 ]
 
+# esp spi != { 100-102}
+[
+    {
+        "match": {
+            "left": {
+                "payload": {
+                    "field": "spi",
+                    "protocol": "esp"
+                }
+            },
+	    "op": "!=",
+            "right": {
+                "set": [
+                    { "range": [ 100, 102 ] }
+                ]
+            }
+        }
+    }
+]
+
 # esp sequence 22
 [
     {
tests/py/inet/ether.t.payload.bridge +0 -21
index 4a6bccbe2553c..e9208008214a3 100644
@@ -1,17 +1,3 @@
-# tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 meta nfproto ipv4 accept
-bridge test-bridge input
-  [ meta load l4proto => reg 1 ]
-  [ cmp eq reg 1 0x00000006 ]
-  [ payload load 2b @ transport header + 2 => reg 1 ]
-  [ cmp eq reg 1 0x00001600 ]
-  [ meta load iiftype => reg 1 ]
-  [ cmp eq reg 1 0x00000001 ]
-  [ payload load 6b @ link header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x0c540f00 0x00000411 ]
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-  [ immediate reg 0 accept ]
-
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 accept
 bridge test-bridge input
   [ meta load l4proto => reg 1 ]
@@ -40,10 +26,3 @@ bridge test-bridge input
   [ cmp eq reg 1 0x0c540f00 0x00000411 ]
   [ immediate reg 0 accept ]
 
-# ether saddr 00:0f:54:0c:11:04 meta nfproto ipv4
-bridge test-bridge input
-  [ payload load 6b @ link header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x0c540f00 0x00000411 ]
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-
tests/py/inet/ether.t.payload.ip +0 -23
index 196930fd8ff52..a604f603c69eb 100644
@@ -1,17 +1,3 @@
-# tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 meta nfproto ipv4 accept
-ip test-ip4 input
-  [ meta load l4proto => reg 1 ]
-  [ cmp eq reg 1 0x00000006 ]
-  [ payload load 2b @ transport header + 2 => reg 1 ]
-  [ cmp eq reg 1 0x00001600 ]
-  [ meta load iiftype => reg 1 ]
-  [ cmp eq reg 1 0x00000001 ]
-  [ payload load 6b @ link header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x0c540f00 0x00000411 ]
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-  [ immediate reg 0 accept ]
-
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 accept
 ip test-ip4 input
   [ meta load l4proto => reg 1 ]
@@ -44,12 +30,3 @@ ip test-ip4 input
   [ cmp eq reg 1 0x0c540f00 0x00000411 ]
   [ immediate reg 0 accept ]
 
-# ether saddr 00:0f:54:0c:11:04 meta nfproto ipv4
-ip test-ip4 input
-  [ meta load iiftype => reg 1 ]
-  [ cmp eq reg 1 0x00000001 ]
-  [ payload load 6b @ link header + 6 => reg 1 ]
-  [ cmp eq reg 1 0x0c540f00 0x00000411 ]
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-
tests/py/inet/reject.t.payload.inet +0 -104

110 lines not on this page · raw message

tests/py/inet/rt.t +2 -3
index 23608ab2c2f9a..a0e0d00305c84 100644
@@ -2,14 +2,13 @@
 
 *inet;test-inet;output
 
-rt nexthop 192.168.0.1;fail
-rt nexthop fd00::1;fail
-
 meta nfproto ipv4 rt nexthop 192.168.0.1;ok;meta nfproto ipv4 rt ip nexthop 192.168.0.1
 rt ip6 nexthop fd00::1;ok
 
 # missing context
+rt nexthop 192.168.0.1;fail
 rt nexthop fd00::1;fail
+
 # wrong context
 rt ip nexthop fd00::1;fail
 
tests/py/inet/sets.t.payload.netdev +1 -1
index 51938c858332a..9d6f6bbd62b1e 100644
@@ -14,7 +14,7 @@ netdev test-netdev ingress
   [ lookup reg 1 set set2 0x1 ]
   [ immediate reg 0 accept ]
 
-# ip saddr . ip daddr . tcp dport @ set3 accept
+# ip saddr . ip daddr . tcp dport @set3 accept
 inet 
   [ meta load nfproto => reg 1 ]
   [ cmp eq reg 1 0x00000002 ]
tests/py/inet/synproxy.t.json +0 -32
index 92c69d75161aa..1dd85a6144db6 100644
@@ -5,24 +5,6 @@
     }
 ]
 
-# synproxy mss 1460
-[
-    {
-        "synproxy": {
-            "mss": 1460
-        }
-    }
-]
-
-# synproxy wscale 7
-[
-    {
-        "synproxy": {
-            "wscale": 7
-        }
-    }
-]
-
 # synproxy mss 1460 wscale 7
 [
     {
@@ -56,20 +38,6 @@
     }
 ]
 
-# synproxy mss 1460 wscale 7 timestamp sack-perm
-[
-    {
-        "synproxy": {
-            "mss": 1460,
-            "wscale": 7,
-            "flags": [
-                "timestamp",
-                "sack-perm"
-            ]
-        }
-    }
-]
-
 # synproxy mss 1460 wscale 5 timestamp sack-perm
 [
     {
tests/py/ip/icmp.t.payload.ip +0 -11
index d75d12a061252..a9001f3164527 100644
@@ -102,17 +102,6 @@ ip test-ip4 input
   [ cmp eq reg 1 0x00000012 ]
   [ immediate reg 0 accept ]
 
-# icmp type {echo-reply, destination-unreachable, source-quench, redirect, echo-request, time-exceeded, parameter-problem, timestamp-request, timestamp-reply, info-request, info-reply, address-mask-request, address-mask-reply} accept
-__set%d test-ip4 3
-__set%d test-ip4 0
-	element 00000000  : 0 [end]	element 00000003  : 0 [end]	element 00000004  : 0 [end]	element 00000005  : 0 [end]	element 00000008  : 0 [end]	element 0000000b  : 0 [end]	element 0000000c  : 0 [end]	element 0000000d  : 0 [end]	element 0000000e  : 0 [end]	element 0000000f  : 0 [end]	element 00000010  : 0 [end]	element 00000011  : 0 [end]	element 00000012  : 0 [end]
-ip test-ip4 input
-  [ meta load l4proto => reg 1 ]
-  [ cmp eq reg 1 0x00000001 ]
-  [ payload load 1b @ transport header + 0 => reg 1 ]
-  [ lookup reg 1 set __set%d ]
-  [ immediate reg 0 accept ]
-
 # icmp type != {echo-reply, destination-unreachable, source-quench}
 __set%d test-ip4 3
 __set%d test-ip4 0
tests/py/ip/igmp.t.payload +0 -228

240 lines not on this page · raw message

tests/py/ip/ip.t +2 -2
index 0421d01bf6e49..04aada2dbccec 100644
@@ -92,8 +92,8 @@ ip saddr set {192.19.1.2, 191.1.22.1};fail
 ip saddr 192.168.2.0/24;ok
 ip saddr != 192.168.2.0/24;ok
 ip saddr 192.168.3.1 ip daddr 192.168.3.100;ok
-ip saddr != 1.1.1.1;ok;ip saddr != 1.1.1.1
-ip saddr 1.1.1.1;ok;ip saddr 1.1.1.1
+ip saddr != 1.1.1.1;ok
+ip saddr 1.1.1.1;ok
 ip daddr 192.168.0.1-192.168.0.250;ok
 ip daddr 10.0.0.0-10.255.255.255;ok
 ip daddr 172.16.0.0-172.31.255.255;ok
tests/py/ip/ip.t.payload +0 -10
index 161ff0a5802b5..578c8d3705930 100644
@@ -502,16 +502,6 @@ ip test-ip4 input
   [ bitwise reg 1 = ( reg 1 & 0x0000ffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000ffff ]
 
-# ip saddr . ip daddr . ip protocol { 1.1.1.1 . 2.2.2.2 . tcp, 1.1.1.1 . 3.3.3.3 . udp}
-__set%d test-ip 3
-__set%d test-ip 0
-	element 01010101 02020202 00000006  : 0 [end]   element 01010101 03030303 00000011  : 0 [end]
-ip test-ip input
-  [ payload load 4b @ network header + 12 => reg 1 ]
-  [ payload load 4b @ network header + 16 => reg 9 ]
-  [ payload load 1b @ network header + 9 => reg 10 ]
-  [ lookup reg 1 set __set%d ]
-
 # ip version 4 ip hdrlength 5
 ip test-ip4 input
   [ payload load 1b @ network header + 0 => reg 1 ]
tests/py/ip/ip.t.payload.inet +0 -12
index c1d707481e863..8c778f99b0fa1 100644
@@ -656,18 +656,6 @@ inet test-inet input
   [ bitwise reg 1 = ( reg 1 & 0x0000ffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000ffff ]
 
-# ip saddr . ip daddr . ip protocol { 1.1.1.1 . 2.2.2.2 . tcp, 1.1.1.1 . 3.3.3.3 . udp}
-__set%d test-ip 3
-__set%d test-ip 0
-        element 01010101 02020202 00000006  : 0 [end]   element 01010101 03030303 00000011  : 0 [end]
-inet test-ip input
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-  [ payload load 4b @ network header + 12 => reg 1 ]
-  [ payload load 4b @ network header + 16 => reg 9 ]
-  [ payload load 1b @ network header + 9 => reg 10 ]
-  [ lookup reg 1 set __set%d ]
-
 # ip version 4 ip hdrlength 5
 inet test-inet input
   [ meta load nfproto => reg 1 ]
tests/py/ip/ip.t.payload.netdev +0 -112

118 lines not on this page · raw message

tests/py/ip6/dnat.t +1 -1
index 28bd7ef97859e..89d5a5f9ee7ae 100644
@@ -3,7 +3,7 @@
 *ip6;test-ip6;prerouting
 
 tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100;ok
-tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:100;ok;tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:100
+tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:100;ok
 tcp dport 80-90 dnat to [2001:838:35f:1::]:80;ok
 dnat to [2001:838:35f:1::]/64;ok;dnat to 2001:838:35f:1::/64
 dnat to 2001:838:35f:1::-2001:838:35f:1:ffff:ffff:ffff:ffff;ok;dnat to 2001:838:35f:1::/64
tests/py/ip6/ether.t +1 -1
index d94a0d2110c93..49d7d06317eca 100644
@@ -3,6 +3,6 @@
 *ip6;test-ip6;input
 
 tcp dport 22 iiftype ether ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:4 accept;ok;tcp dport 22 ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:04 accept
-tcp dport 22 ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:04;ok;tcp dport 22 ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:04
+tcp dport 22 ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:04;ok
 tcp dport 22 ether saddr 00:0f:54:0c:11:04 ip6 daddr 1::2;ok
 ether saddr 00:0f:54:0c:11:04 ip6 daddr 1::2 accept;ok
tests/py/ip6/frag.t.payload.inet +0 -8
index 917742ffbcf03..ff1458d2b3b1b 100644
@@ -192,14 +192,6 @@ inet test-inet output
   [ bitwise reg 1 = ( reg 1 & 0x0000f8ff ) ^ 0x00000000 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
-# frag more-fragments 1
-inet test-inet output
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x0000000a ]
-  [ exthdr load ipv6 1b @ 44 + 3 => reg 1 ]
-  [ bitwise reg 1 = ( reg 1 & 0x00000001 ) ^ 0x00000000 ]
-  [ cmp eq reg 1 0x00000001 ]
-
 # frag id 1
 inet test-inet output
   [ meta load nfproto => reg 1 ]
tests/py/ip6/frag.t.payload.ip6 +0 -6
index 2405fff81389f..dc4103fd11ede 100644
@@ -148,12 +148,6 @@ ip6 test-ip6 output
   [ bitwise reg 1 = ( reg 1 & 0x0000f8ff ) ^ 0x00000000 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
-# frag more-fragments 1
-ip6 test-ip6 output
-  [ exthdr load ipv6 1b @ 44 + 3 => reg 1 ]
-  [ bitwise reg 1 = ( reg 1 & 0x00000001 ) ^ 0x00000000 ]
-  [ cmp eq reg 1 0x00000001 ]
-
 # frag id 1
 ip6 test-ip6 output
   [ exthdr load ipv6 4b @ 44 + 4 => reg 1 ]
tests/py/ip6/icmpv6.t +1 -1
index 8b411a8bf4392..9a4c8a6be4b12 100644
@@ -38,7 +38,7 @@ icmpv6 code != { 3-66};ok
 icmpv6 checksum 2222 log;ok
 icmpv6 checksum != 2222 log;ok
 icmpv6 checksum 222-226;ok
-icmpv6 checksum != 2222 log;ok
+icmpv6 checksum != 222-226;ok
 icmpv6 checksum { 222, 226};ok
 icmpv6 checksum != { 222, 226};ok
 icmpv6 checksum { 222-226};ok
tests/py/ip6/icmpv6.t.json +5 -6
index ffc4931c4e0c4..2825d4cc5594a 100644
@@ -640,7 +640,7 @@
     }
 ]
 
-# icmpv6 checksum != 2222 log
+# icmpv6 checksum != 222-226
 [
     {
         "match": {
@@ -650,12 +650,11 @@
                     "protocol": "icmpv6"
                 }
             },
-            "op": "!=",
-            "right": 2222
+	    "op": "!=",
+            "right": {
+                "range": [ 222, 226 ]
+            }
         }
-    },
-    {
-        "log": null
     }
 ]
 
tests/py/ip6/icmpv6.t.payload.ip6 +3 -4
index 171b7eade6d3e..333801c1c3e6b 100644
@@ -275,13 +275,12 @@ ip6 test-ip6 input
   [ cmp gte reg 1 0x0000de00 ]
   [ cmp lte reg 1 0x0000e200 ]
 
-# icmpv6 checksum != 2222 log
-ip6 test-ip6 input
+# icmpv6 checksum != 222-226
+ip6
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
-  [ cmp neq reg 1 0x0000ae08 ]
-  [ log ]
+  [ range neq reg 1 0x0000de00 0x0000e200 ]
 
 # icmpv6 checksum { 222, 226}
 __set%d test-ip6 3
tests/py/ip6/ip6.t +1 -1
index 8210d22be3d58..dbb56fa3085b9 100644
@@ -26,7 +26,7 @@ ip6 flowlabel { 33, 55, 67, 88};ok
 ip6 flowlabel != { 33, 55, 67, 88};ok
 ip6 flowlabel { 33-55};ok
 ip6 flowlabel != { 33-55};ok
-ip6 flowlabel vmap { 0 : accept, 2 : continue } ;ok
+ip6 flowlabel vmap { 0 : accept, 2 : continue };ok
 
 ip6 length 22;ok
 ip6 length != 233;ok
tests/py/ip6/ip6.t.payload.inet +1 -1
index 8912aadf116cf..11ba34a1bca2b 100644
@@ -113,7 +113,7 @@ inet test-inet input
   [ bitwise reg 1 = ( reg 1 & 0x00ffff0f ) ^ 0x00000000 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
-# ip6 flowlabel vmap { 0 : accept, 2 : continue } 
+# ip6 flowlabel vmap { 0 : accept, 2 : continue }
 __map%d test-inet b size 2
 __map%d test-inet 0
 	element 00000000  : 0 [end]	element 00020000  : 0 [end]
tests/py/ip6/ip6.t.payload.ip6 +1 -1
index 287d58ac00bf6..78479253abbdf 100644
@@ -89,7 +89,7 @@ ip6 test-ip6 input
   [ bitwise reg 1 = ( reg 1 & 0x00ffff0f ) ^ 0x00000000 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
-# ip6 flowlabel vmap { 0 : accept, 2 : continue } 
+# ip6 flowlabel vmap { 0 : accept, 2 : continue }
 __map%d test-ip6 b size 2
 __map%d test-ip6 0
 	element 00000000  : 0 [end]	element 00020000  : 0 [end]
tests/py/ip6/snat.t +1 -1
index c259f9342cddf..564f0894937c6 100644
@@ -2,5 +2,5 @@
 
 *ip6;test-ip6;postrouting
 
-tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100;ok;tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100
+tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100;ok
 tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:100;ok
tests/py/tools/test-sanitizer.sh new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.28.0