summaryrefslogtreecommitdiffstats
path: root/src/evaluate.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-03-17 10:39:27 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-03-17 13:23:45 +0100
commitfde8ddfc31bbc4015e8a76b40cc7e27bcd7920ff (patch)
tree33c8e5ca8bdb473d772950359e57a326738c2e91 /src/evaluate.c
parent48632359f4dea5ee2484debba498ba069229e6d0 (diff)
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>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r--src/evaluate.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index 8de5e48d..6ae94b0f 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2465,42 +2465,6 @@ static int stmt_evaluate_nat(struct eval_ctx *ctx, struct stmt *stmt)
return 0;
}
-static int stmt_evaluate_masq(struct eval_ctx *ctx, struct stmt *stmt)
-{
- int err;
-
- err = nat_evaluate_family(ctx, stmt);
- if (err < 0)
- return err;
-
- if (stmt->masq.proto != NULL) {
- err = nat_evaluate_transport(ctx, stmt, &stmt->masq.proto);
- if (err < 0)
- return err;
- }
-
- stmt->flags |= STMT_F_TERMINAL;
- return 0;
-}
-
-static int stmt_evaluate_redir(struct eval_ctx *ctx, struct stmt *stmt)
-{
- int err;
-
- err = nat_evaluate_family(ctx, stmt);
- if (err < 0)
- return err;
-
- if (stmt->redir.proto != NULL) {
- err = nat_evaluate_transport(ctx, stmt, &stmt->redir.proto);
- if (err < 0)
- return err;
- }
-
- stmt->flags |= STMT_F_TERMINAL;
- return 0;
-}
-
static int stmt_evaluate_dup(struct eval_ctx *ctx, struct stmt *stmt)
{
int err;
@@ -2758,10 +2722,6 @@ int stmt_evaluate(struct eval_ctx *ctx, struct stmt *stmt)
return stmt_evaluate_reject(ctx, stmt);
case STMT_NAT:
return stmt_evaluate_nat(ctx, stmt);
- case STMT_MASQ:
- return stmt_evaluate_masq(ctx, stmt);
- case STMT_REDIR:
- return stmt_evaluate_redir(ctx, stmt);
case STMT_QUEUE:
return stmt_evaluate_queue(ctx, stmt);
case STMT_DUP: