]> git.ipfire.org Git - thirdparty/nftables.git/commit
Combine redir and masq statements into nat
authorPhil Sutter <phil@nwl.cc>
Sat, 17 Mar 2018 09:39:27 +0000 (10:39 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 17 Mar 2018 12:23:45 +0000 (13:23 +0100)
commitfde8ddfc31bbc4015e8a76b40cc7e27bcd7920ff
tree33c8e5ca8bdb473d772950359e57a326738c2e91
parent48632359f4dea5ee2484debba498ba069229e6d0
Combine redir and masq statements into nat

All these statements are very similar, handling them with the same code
is obvious. The only thing required here is a custom extension of enum
nft_nat_types which is used in nat_stmt to distinguish between snat and
dnat already. Though since enum nft_nat_types is part of kernel uAPI,
create a local extended version containing the additional fields.

Note that nat statement printing got a bit more complicated to get the
number of spaces right for every possible combination of attributes.

Note also that there wasn't a case for STMT_MASQ in
rule_parse_postprocess(), which seems like a bug. Since STMT_MASQ became
just a variant of STMT_NAT, postprocessing will take place for it now
anyway.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/statement.h
src/evaluate.c
src/netlink_delinearize.c
src/netlink_linearize.c
src/parser_bison.y
src/statement.c