]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: avoid errouneous assert with map+concat
authorFlorian Westphal <fw@strlen.de>
Tue, 27 Mar 2018 07:29:54 +0000 (09:29 +0200)
committerFlorian Westphal <fw@strlen.de>
Tue, 27 Mar 2018 09:36:58 +0000 (11:36 +0200)
commit483e5ea7167e1537accf4cb083b88a8beea8f834
tree9828b350a3b59b8d201544a720359ce2663d4827
parent65a9d639ddac244ff3abc9dfde30482ff4a4c336
src: avoid errouneous assert with map+concat

Phil reported following assert:

add rule ip6 f o mark set ip6 saddr . ip6 daddr . tcp dport \
                        map { dead::beef . f00::. 22 : 1 }
nft: netlink_linearize.c:655: netlink_gen_expr: Assertion `dreg < ctx->reg_low' failed.

This happens because "mark set" will allocate one register (the dreg),
but netlink_gen_concat_expr will populate a lot more register space if
the concat expression strings a lot of expressions together.

As the assert is useful pseudo-reserve the register space as per
concat->len and undo after generating the expressions.

Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/netlink_linearize.c