diff options
author | Florian Westphal <fw@strlen.de> | 2021-12-03 20:19:10 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2021-12-09 11:12:32 +0100 |
commit | b2591d4b13ab95240216a93d682b842c28b2b884 (patch) | |
tree | 4e811645bd28b970db28edaa8b953cfa87034914 /tests/shell/testcases | |
parent | 95a8503d019a81ec9225a7ae4cb10d115acac2b9 (diff) |
netlink_delinearize: zero shift removal
Remove shifts-by-0. These can occur after binop postprocessing
has adjusted the RHS value to account for a mask operation.
Example: frag frag-off @s4
Is internally represented via:
[ exthdr load ipv6 2b @ 44 + 2 => reg 1 ]
[ bitwise reg 1 = ( reg 1 & 0x0000f8ff ) ^ 0x00000000 ]
[ bitwise reg 1 = ( reg 1 >> 0x00000003 ) ]
[ lookup reg 1 set s ]
First binop masks out unwanted parts of the 16-bit field.
Second binop needs to left-shift so that lookups in the set will work.
When decoding, the first binop is removed after the exthdr load
has been adjusted accordingly. Constant propagation adjusts the
shift-value to 0 on removal. This change then gets rid of the
shift-by-0 entirely.
After this change, 'frag frag-off @s4' input is shown as-is.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/testcases')
-rw-r--r-- | tests/shell/testcases/sets/dumps/typeof_sets_0.nft | 8 | ||||
-rwxr-xr-x | tests/shell/testcases/sets/typeof_sets_0 | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/dumps/typeof_sets_0.nft b/tests/shell/testcases/sets/dumps/typeof_sets_0.nft index ad442713..e397a634 100644 --- a/tests/shell/testcases/sets/dumps/typeof_sets_0.nft +++ b/tests/shell/testcases/sets/dumps/typeof_sets_0.nft @@ -53,6 +53,10 @@ table inet t { vlan id @s2 accept } + chain c4 { + frag frag-off @s4 accept + } + chain c5 { ip option ra value @s5 accept } @@ -65,6 +69,10 @@ table inet t { sctp chunk init num-inbound-streams @s7 accept } + chain c8 { + ip version @s8 accept + } + chain c9 { ip hdrlength @s9 accept } diff --git a/tests/shell/testcases/sets/typeof_sets_0 b/tests/shell/testcases/sets/typeof_sets_0 index 2102789e..be906cdc 100755 --- a/tests/shell/testcases/sets/typeof_sets_0 +++ b/tests/shell/testcases/sets/typeof_sets_0 @@ -58,6 +58,10 @@ EXPECTED="table inet t { ether type vlan vlan id @s2 accept } + chain c4 { + frag frag-off @s4 accept + } + chain c5 { ip option ra value @s5 accept } @@ -70,6 +74,10 @@ EXPECTED="table inet t { sctp chunk init num-inbound-streams @s7 accept } + chain c8 { + ip version @s8 accept + } + chain c9 { ip hdrlength @s9 accept } |