]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: evaluate: add preliminary binop transfer support for vmaps
authorFlorian Westphal <fw@strlen.de>
Thu, 11 Jan 2018 15:30:23 +0000 (16:30 +0100)
committerFlorian Westphal <fw@strlen.de>
Sat, 17 Mar 2018 00:47:18 +0000 (01:47 +0100)
commit48632359f4dea5ee2484debba498ba069229e6d0
treee47b6d1e6fbef60850855029dcf188c5770f3c32
parentccf7c4fc9af2b982c24a7a3b40ecc5ebbe93ecef
src: evaluate: add preliminary binop transfer support for vmaps

nftables doesn't support vmap with bit-sized headers, such as flow label or dscp:

nft add rule ip filter input ip dscp vmap \{ 4 : accept, 63 : continue \}
BUG: invalid binary operation 5

Unlike plain "ip dscp { 4, 63 }", we don't have a relational operation in
case of vmap. Binop fixups need to be done when evaluating map statements.

This patch is incomplete. 'ip dscp' works, but this won't:
  nft add rule --debug=netlink ip6 test-ip6 input ip6 dscp vmap { 0x04 : accept, 0x3f : continue }

The generated expressions look sane, however there is disagreement on
the sets key size vs. the sizes of the individual elements in the set.
This is because ip6 dscp spans a byte boundary.

Key set size is still set to one byte (dscp type is 6bits).
However, binop expansion requirements result in 2 byte loads, i.e.
set members will be 2 bytes in size as well.

This can hopefully get addressed in an incremental patch.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/evaluate.c