]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink_delinearize: support for bitfield payload statement with binary operation
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 28 Feb 2025 15:18:43 +0000 (16:18 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 7 Mar 2025 12:56:47 +0000 (13:56 +0100)
commit77def2d43466e99c146243e186a9fb6698b6a1a0
tree70f10e66473928aff375792e9434c9e22f6d2da5
parentee32bc90b80f329822b1dd3ee35f2eb98ae7f260
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>
include/payload.h
src/netlink_delinearize.c
src/payload.c
tests/py/ip/ip.t
tests/py/ip/ip.t.json
tests/py/ip/ip.t.payload
tests/py/ip/ip.t.payload.bridge
tests/py/ip/ip.t.payload.inet
tests/py/ip/ip.t.payload.netdev