Revert ("src: Remove xt_stmt_() functions").
Pablo Neira Ayuso
maintainerPATCH 1/1 Revert ("src: Remove xt_stmt_() functions").
Revert commit bce55916b51ec1a4c23322781e3b0c698ecc9561, we need this code in place to properly make translation when iptables-compat loads rules.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- include/statement.h | 2 ++ include/xt.h | 7 +++++ src/statement.c | 23 ++++++++++++++++ src/xt.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 106 insertions(+), 2 deletions(-)
include/statement.h +2 -0
@@ -203,6 +203,8 @@ struct xt_stmt {void *entry; }; +extern struct stmt *xt_stmt_alloc (const struct location *loc); +/** * enum stmt_types - statement types *
include/xt.h +7 -0
@@ -8,6 +8,9 @@ struct rule_pp_ctx;struct rule ;#ifdef HAVE_LIBXTABLES +void xt_stmt_xlate (const struct stmt *stmt); +void xt_stmt_release (const struct stmt *stmt); +void netlink_parse_target (struct netlink_parse_ctx *ctx,const struct location *loc,const struct nftnl_expr *nle);
@@ -17,6 +20,9 @@ void netlink_parse_match(struct netlink_parse_ctx *ctx,void stmt_xt_postprocess (struct rule_pp_ctx *rctx,struct stmt *stmt,struct rule *rule);#else +static inline void xt_stmt_xlate (const struct stmt *stmt) {} +static inline void xt_stmt_release (const struct stmt *stmt) {} +#include <erec.h> static inline void netlink_parse_target(struct netlink_parse_ctx *ctx,
@@ -29,4 +35,5 @@ static inline void stmt_xt_postprocess(struct rule_pp_ctx *rctx, struct stmt *stmt, struct rule *rule) {}#endif +#endif /* _NFT_XT_H_ */
src/statement.c +23 -0
@@ -694,3 +694,26 @@ 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,struct output_ctx *octx) +{ +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); +}
src/xt.c +74 -2
94 lines not on this page · raw message
Signature · 1 line
2.11.0