]> git.ipfire.org Git - thirdparty/iptables.git/commit
nft: Fix -Z for rules with NFTA_RULE_COMPAT
authorPhil Sutter <phil@nwl.cc>
Fri, 15 Nov 2019 09:47:25 +0000 (10:47 +0100)
committerPhil Sutter <phil@nwl.cc>
Fri, 15 Nov 2019 14:45:18 +0000 (15:45 +0100)
commit7a373f6683afb799c8387bdec1da6a07e9e55b33
tree9ed419fb1b03a4014a9e80402b22399232801f31
parent7084d0b6c95b11f03b3ae979fe30b6918cb26542
nft: Fix -Z for rules with NFTA_RULE_COMPAT

The special nested attribute NFTA_RULE_COMPAT holds information about
any present l4proto match (given via '-p' parameter) in input. The match
is contained as meta expression as well, but some xtables extensions
explicitly check it's value (see e.g. xt_TPROXY).

This nested attribute is input only, the information is lost after
parsing (and initialization of compat extensions). So in order to feed a
rule back to kernel with zeroed counters, the attribute has to be
reconstructed based on the rule's expressions.

Other code paths are not affected since rule_to_cs() callback will
populate respective fields in struct iptables_command_state and 'add'
callback (which is the inverse to rule_to_cs()) calls add_compat() in
any case.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c