]> git.ipfire.org Git - thirdparty/nftables.git/commit
netlink: swap byteorder of value component in concatenation of intervals
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 8 Dec 2022 00:35:05 +0000 (01:35 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 8 Dec 2022 02:12:32 +0000 (03:12 +0100)
commit508f3a27053169970211fc9a3f4ba973288f8d78
treee738759bda063887e147313871d59fce712889da
parenta8fb933956efbcabd05cc718623bf88a94cf6304
netlink: swap byteorder of value component in concatenation of intervals

Commit 1017d323cafa ("src: support for selectors with different byteorder with
interval concatenations") was incomplete.

Switch byteorder of singleton values in a set that contains
concatenation of intervals. This singleton value is actually represented
as a range in the kernel.

After this patch, if the set represents a concatenation of intervals:

- EXPR_F_INTERVAL denotes the lhs of the interval.
- EXPR_F_INTERVAL_END denotes the rhs of the interval (this flag was
  already used in this way before this patch).

If none of these flags are set on, then the set contains concatenations
of singleton values (no interval flag is set on), in such case, no
byteorder swap is required.

Update tests/shell and tests/py to cover the use-case breakage reported
by Eric.

Fixes: 1017d323cafa ("src: support for selectors with different byteorder with interval concatenations")
Reported-by: Eric Garver <eric@garver.life>
Tested-by: Eric Garver <eric@garver.life>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink.c
tests/py/inet/meta.t
tests/py/inet/meta.t.json
tests/py/inet/meta.t.payload
tests/shell/testcases/sets/concat_interval_0
tests/shell/testcases/sets/dumps/concat_interval_0.nft