]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: allow to use integer type header fields via typeof set declaration
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 28 Mar 2022 15:36:40 +0000 (17:36 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 29 Mar 2022 09:01:45 +0000 (11:01 +0200)
commit82762ab6f261226030debd5ffe4e22d987ebdb7b
treeed0d594178a3ceb2fd83ba0dabd364e9e7c1eefe
parent64bb3f43bb96bb43a478f695f5aea5f4ab50fd4b
src: allow to use integer type header fields via typeof set declaration

Header fields such as udp length cannot be used in concatenations because
it is using the generic integer_type:

 test.nft:3:10-19: Error: can not use variable sized data types (integer) in concat expressions
                typeof udp length . @th,32,32
                       ^^^^^^^^^^~~~~~~~~~~~~

This patch slightly extends ("src: allow to use typeof of raw expressions in
set declaration") to set on NFTNL_UDATA_SET_KEY_PAYLOAD_LEN in userdata if
TYPE_INTEGER is used.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c
src/payload.c
tests/shell/testcases/maps/dumps/typeof_integer_0.nft [new file with mode: 0644]
tests/shell/testcases/maps/typeof_integer_0 [new file with mode: 0755]