src: expand create commands
Pablo Neira Ayuso
maintainerPATCH 1/1 src: expand create commands
create commands also need to be expanded, otherwise elements are never evaluated:
# cat ruleset.nft
define ip-block-4 = { 1.1.1.1 }
create set netdev filter ip-block-4-test {
type ipv4_addr
flags interval
auto-merge
elements = $ip-block-4
}
# nft -f ruleset.nft
BUG: unhandled expression type 0
nft: src/intervals.c:211: interval_expr_key: Assertion `0' failed.
AbortedSame applies to chains in the form of:
create chain x y {
counter
}
which is also accepted by the parser.
Fixes 56c90a2dd2eb ("evaluate: expand sets and maps before evaluation")
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
I will post a v2 includes tests.
src/libnftables.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/libnftables.c +2 -1
@@ -532,7 +532,8 @@ static int nft_evaluate(struct nft_ctx *nft, struct list_head *msgs, collapsed = true;list_for_each_entry (cmd, cmds, list) { -if (cmd->op !=CMD_ADD ) +if (cmd->op !=CMD_ADD && + cmd->op !=CMD_CREATE )continue ;nft_cmd_expand (cmd);
Signature · 1 line
2.30.2