diff options
author | Florian Westphal <fw@strlen.de> | 2023-09-28 23:27:55 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-09-29 12:36:33 +0200 |
commit | 99ab1b8feb16741a83fb8b887bacae8fa07d29a2 (patch) | |
tree | c8b67d32aa10bac630c3a873b8128af873bf4e45 /tests/py/ip | |
parent | 15a7d710dc892c0e68f118ca3e6106c84b30a83b (diff) |
rule: never merge across non-expression statements
The existing logic can merge across non-expression statements,
if there is only one payload expression.
Example:
ether saddr 00:11:22:33:44:55 counter ether type 8021q
is turned into
counter ether saddr 00:11:22:33:44:55 ether type 8021q
which isn't the same thing.
Fix this up and add test cases for adjacent vlan and ip header
fields. 'Counter' serves as a non-merge fence.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/py/ip')
-rw-r--r-- | tests/py/ip/ip.t | 3 | ||||
-rw-r--r-- | tests/py/ip/ip.t.payload | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/py/ip/ip.t b/tests/py/ip/ip.t index a8f0d820..720d9ae9 100644 --- a/tests/py/ip/ip.t +++ b/tests/py/ip/ip.t @@ -130,3 +130,6 @@ iif "lo" ip dscp set cs0;ok ip saddr . ip daddr { 192.0.2.1 . 10.0.0.1-10.0.0.2 };ok ip saddr . ip daddr vmap { 192.168.5.1-192.168.5.128 . 192.168.6.1-192.168.6.128 : accept };ok + +ip saddr 1.2.3.4 ip daddr 3.4.5.6;ok +ip saddr 1.2.3.4 counter ip daddr 3.4.5.6;ok diff --git a/tests/py/ip/ip.t.payload b/tests/py/ip/ip.t.payload index 8224d4cd..43605a36 100644 --- a/tests/py/ip/ip.t.payload +++ b/tests/py/ip/ip.t.payload @@ -541,3 +541,18 @@ ip [ payload load 4b @ network header + 12 => reg 1 ] [ payload load 4b @ network header + 16 => reg 9 ] [ lookup reg 1 set __map%d dreg 0 ] + +# ip saddr 1.2.3.4 ip daddr 3.4.5.6 +ip test-ip4 input + [ payload load 4b @ network header + 12 => reg 1 ] + [ cmp eq reg 1 0x04030201 ] + [ payload load 4b @ network header + 16 => reg 1 ] + [ cmp eq reg 1 0x06050403 ] + +# ip saddr 1.2.3.4 counter ip daddr 3.4.5.6 +ip test-ip4 input + [ payload load 4b @ network header + 12 => reg 1 ] + [ cmp eq reg 1 0x04030201 ] + [ counter pkts 0 bytes 0 ] + [ payload load 4b @ network header + 16 => reg 1 ] + [ cmp eq reg 1 0x06050403 ] |