diff options
Diffstat (limited to 'src/statement.c')
-rw-r--r-- | src/statement.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/statement.c b/src/statement.c index 76f528b3..7778a955 100644 --- a/src/statement.c +++ b/src/statement.c @@ -23,6 +23,7 @@ #include <statement.h> #include <utils.h> #include <list.h> +#include <xt.h> #include <netinet/in.h> #include <linux/netfilter/nf_nat.h> @@ -567,3 +568,27 @@ struct stmt *fwd_stmt_alloc(const struct location *loc) { return stmt_alloc(loc, &fwd_stmt_ops); } + +static void xt_stmt_print(const struct stmt *stmt) +{ + xt_stmt_xlate(stmt); +} + +static void xt_stmt_destroy(struct stmt *stmt) +{ + xfree(stmt->xt.name); + xfree(stmt->xt.opts); + xt_stmt_release(stmt); +} + +static const struct stmt_ops xt_stmt_ops = { + .type = STMT_XT, + .name = "xt", + .print = xt_stmt_print, + .destroy = xt_stmt_destroy, +}; + +struct stmt *xt_stmt_alloc(const struct location *loc) +{ + return stmt_alloc(loc, &xt_stmt_ops); +} |