]> git.ipfire.org Git - thirdparty/nftables.git/commit
evaluate: avoid reference to multiple src data in statements which set values
authorArturo Borrero Gonzalez <arturo@debian.org>
Fri, 26 May 2017 11:00:21 +0000 (13:00 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 29 May 2017 10:59:40 +0000 (12:59 +0200)
commit986dea8a4a9d612a63508f628d342f70146ac6d0
tree2354c0e69fd4d79af9d821eacb0e101650f2b6eb
parent6be8a855fc4abd32646dda879d10b9f7854863e7
evaluate: avoid reference to multiple src data in statements which set values

Prevent this assert:

% nft [..] tcp dport set { 0 , 1 }
BUG: unknown expression type set reference
nft: netlink_linearize.c:696: netlink_gen_expr: Assertion `0' failed.
Aborted

We can't use a set here because we will not known which value to use.

With this patch, a proper error message is reported to users:

% nft add rule t c tcp dport set {1, 2, 3, 4, 5}
<cmdline>:1:28-42: Error: you cannot use a set here, unknown value to use
add rule t c tcp dport set {1, 2, 3, 4, 5}
             ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^

% nft add rule t c tcp dport set @s
<cmdline>:1:28-29: Error: you cannot reference a set here, unknown value to use
add rule t c tcp dport set @s
             ~~~~~~~~~~~~~~^^

This error is reported to all statements which set values.

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c