summaryrefslogtreecommitdiffstats
path: root/tests/py/ip/ip.t
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2025-02-28 16:18:43 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2025-03-07 13:56:47 +0100
commit77def2d43466e99c146243e186a9fb6698b6a1a0 (patch)
tree70f10e66473928aff375792e9434c9e22f6d2da5 /tests/py/ip/ip.t
parentee32bc90b80f329822b1dd3ee35f2eb98ae7f260 (diff)
netlink_delinearize: support for bitfield payload statement with binary operation
Add a new function to deal with payload statement delinearization with binop expression. Infer the payload offset from the mask, then walk the template list to determine if estimated offset falls within a matching header field. If so, then validate that this is not a raw expression but an actual bitfield matching. Finally, trim the payload expression length accordingly and adjust the payload offset. instead of: @nh,8,5 set 0x0 it displays: ip dscp and 0x1 Update tests/py to cover for this enhancement. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/py/ip/ip.t')
-rw-r--r--tests/py/ip/ip.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/py/ip/ip.t b/tests/py/ip/ip.t
index e6999c29..47262d9a 100644
--- a/tests/py/ip/ip.t
+++ b/tests/py/ip/ip.t
@@ -135,3 +135,20 @@ 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
ip dscp 1/6;ok;ip dscp & 0x3f == lephb
+
+ip ecn set ip ecn | ect0;ok
+ip ecn set ip ecn | ect1;ok
+ip ecn set ip ecn & ect0;ok
+ip ecn set ip ecn & ect1;ok
+tcp flags set tcp flags & (fin | syn | rst | psh | ack | urg);ok
+tcp flags set tcp flags | ecn | cwr;ok
+ip dscp set ip dscp | lephb;ok
+ip dscp set ip dscp & lephb;ok
+ip dscp set ip dscp & 0x1f;ok
+ip dscp set ip dscp & 0x4f;fail
+ip version set ip version | 1;ok
+ip version set ip version & 1;ok
+ip version set ip version | 0x1f;fail
+ip hdrlength set ip hdrlength | 1;ok
+ip hdrlength set ip hdrlength & 1;ok
+ip hdrlength set ip hdrlength | 0x1f;fail