diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2014-10-06 21:51:24 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-10-09 18:46:36 +0200 |
commit | cf8c90ea9985c9019b002037629ee362b5c50343 (patch) | |
tree | 34f830fcf6c69590a304e23351cafba9fafb86cb /src/statement.c | |
parent | b0fedf634ce4ce81212294e5bef554dcd46746e1 (diff) |
src: add masquerade support
This patch adds masquerade support for nft.
The syntax is:
% nft add rule nat postrouting masquerade [flags]
Currently, flags are:
random, random-fully, persistent
Example:
% nft add rule nat postrouting masquerade random,persistent
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/statement.c')
-rw-r--r-- | src/statement.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/statement.c b/src/statement.c index f1d83fcb..0ae616a8 100644 --- a/src/statement.c +++ b/src/statement.c @@ -330,3 +330,21 @@ struct stmt *nat_stmt_alloc(const struct location *loc) { return stmt_alloc(loc, &nat_stmt_ops); } + +static void masq_stmt_print(const struct stmt *stmt) +{ + printf("masquerade"); + + print_nf_nat_flags(stmt->masq.flags); +} + +static const struct stmt_ops masq_stmt_ops = { + .type = STMT_MASQ, + .name = "masq", + .print = masq_stmt_print, +}; + +struct stmt *masq_stmt_alloc(const struct location *loc) +{ + return stmt_alloc(loc, &masq_stmt_ops); +} |