summaryrefslogtreecommitdiffstats
path: root/tests/py/ip/ip.t.payload
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2025-02-17 10:23:24 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2025-02-21 23:23:16 +0100
commit50741c52fe57fd09fa9cbd1a1626bfdd2f4115d8 (patch)
treea646a07e43d8f6de2ccec8b4d5ed4c5954618fdc /tests/py/ip/ip.t.payload
parent347039f64509e77ad5f6ef52ae70950c91886f8e (diff)
netlink_linearize: use range expression for OP_EQ and OP_IMPLICIT
range expression is available since v4.9-rc1~127^2~67^2~3, replace the two cmp expression when generating netlink bytecode. Code to delinearize the two cmp expressions to represent the range remains in place for backwards compatibility. The delinearize path to parse range expressions with NFT_OP_EQ is already present since: 3ed932917cc7 ("src: use new range expression for != [a,b] intervals") Update tests/py payload accordingly, json tests need no update since they already use the range to represent them. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/ip/ip.t.payload')
-rw-r--r--tests/py/ip/ip.t.payload33
1 files changed, 11 insertions, 22 deletions
diff --git a/tests/py/ip/ip.t.payload b/tests/py/ip/ip.t.payload
index d7ddf7be..b0e9efa5 100644
--- a/tests/py/ip/ip.t.payload
+++ b/tests/py/ip/ip.t.payload
@@ -63,8 +63,7 @@ ip test-ip4 input
# ip length 333-435
ip test-ip4 input
[ payload load 2b @ network header + 2 => reg 1 ]
- [ cmp gte reg 1 0x00004d01 ]
- [ cmp lte reg 1 0x0000b301 ]
+ [ range eq reg 1 0x00004d01 0x0000b301 ]
# ip length != 333-453
ip test-ip4 input
@@ -100,8 +99,7 @@ ip test-ip4 input
# ip id 33-45
ip test-ip4 input
[ payload load 2b @ network header + 4 => reg 1 ]
- [ cmp gte reg 1 0x00002100 ]
- [ cmp lte reg 1 0x00002d00 ]
+ [ range eq reg 1 0x00002100 0x00002d00 ]
# ip id != 33-45
ip test-ip4 input
@@ -138,8 +136,7 @@ ip test-ip4 input
# ip frag-off 0x21-0x2d
ip test-ip4 input
[ payload load 2b @ network header + 6 => reg 1 ]
- [ cmp gte reg 1 0x00002100 ]
- [ cmp lte reg 1 0x00002d00 ]
+ [ range eq reg 1 0x00002100 0x00002d00 ]
# ip frag-off != 0x21-0x2d
ip test-ip4 input
@@ -194,8 +191,7 @@ ip test-ip4 input
# ip ttl 33-55
ip test-ip4 input
[ payload load 1b @ network header + 8 => reg 1 ]
- [ cmp gte reg 1 0x00000021 ]
- [ cmp lte reg 1 0x00000037 ]
+ [ range eq reg 1 0x00000021 0x00000037 ]
# ip ttl != 45-50
ip test-ip4 input
@@ -270,8 +266,7 @@ ip test-ip4 input
# ip checksum 33-45
ip test-ip4 input
[ payload load 2b @ network header + 10 => reg 1 ]
- [ cmp gte reg 1 0x00002100 ]
- [ cmp lte reg 1 0x00002d00 ]
+ [ range eq reg 1 0x00002100 0x00002d00 ]
# ip checksum != 33-45
ip test-ip4 input
@@ -324,26 +319,22 @@ ip test-ip4 input
# ip daddr 192.168.0.1-192.168.0.250
ip test-ip4 input
[ payload load 4b @ network header + 16 => reg 1 ]
- [ cmp gte reg 1 0x0100a8c0 ]
- [ cmp lte reg 1 0xfa00a8c0 ]
+ [ range eq reg 1 0x0100a8c0 0xfa00a8c0 ]
# ip daddr 10.0.0.0-10.255.255.255
ip test-ip4 input
[ payload load 4b @ network header + 16 => reg 1 ]
- [ cmp gte reg 1 0x0000000a ]
- [ cmp lte reg 1 0xffffff0a ]
+ [ range eq reg 1 0x0000000a 0xffffff0a ]
# ip daddr 172.16.0.0-172.31.255.255
ip test-ip4 input
[ payload load 4b @ network header + 16 => reg 1 ]
- [ cmp gte reg 1 0x000010ac ]
- [ cmp lte reg 1 0xffff1fac ]
+ [ range eq reg 1 0x000010ac 0xffff1fac ]
# ip daddr 192.168.3.1-192.168.4.250
ip test-ip4 input
[ payload load 4b @ network header + 16 => reg 1 ]
- [ cmp gte reg 1 0x0103a8c0 ]
- [ cmp lte reg 1 0xfa04a8c0 ]
+ [ range eq reg 1 0x0103a8c0 0xfa04a8c0 ]
# ip daddr != 192.168.0.1-192.168.0.250
ip test-ip4 input
@@ -371,8 +362,7 @@ ip test-ip4 input
# ip daddr 192.168.1.2-192.168.1.55
ip test-ip4 input
[ payload load 4b @ network header + 16 => reg 1 ]
- [ cmp gte reg 1 0x0201a8c0 ]
- [ cmp lte reg 1 0x3701a8c0 ]
+ [ range eq reg 1 0x0201a8c0 0x3701a8c0 ]
# ip daddr != 192.168.1.2-192.168.1.55
ip test-ip4 input
@@ -382,8 +372,7 @@ ip test-ip4 input
# ip saddr 192.168.1.3-192.168.33.55
ip test-ip4 input
[ payload load 4b @ network header + 12 => reg 1 ]
- [ cmp gte reg 1 0x0301a8c0 ]
- [ cmp lte reg 1 0x3721a8c0 ]
+ [ range eq reg 1 0x0301a8c0 0x3721a8c0 ]
# ip saddr != 192.168.1.3-192.168.33.55
ip test-ip4 input