summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVarsha Rao <rvarsha016@gmail.com>2017-08-16 19:48:13 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2017-08-17 12:48:20 +0200
commitbce55916b51ec1a4c23322781e3b0c698ecc9561 (patch)
tree695582fe195eee42f4e7ac56f296eba8bec8c53b /src
parent96c1346d5c230d2c381b9c1c9e8e2b30d3915ea1 (diff)
src: Remove xt_stmt_() functions.
Remove functions xt_stmt_alloc(), xt_stmt_release(), xt_stmt_xlate(), xt_stmt_print(), xt_stmt_destroy() as they are not used. Similarly, remove structure xt_stmt_ops. Signed-off-by: Varsha Rao <rvarsha016@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/statement.c23
-rw-r--r--src/xt.c74
2 files changed, 0 insertions, 97 deletions
diff --git a/src/statement.c b/src/statement.c
index 0ce875eb..58f8aaf6 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -689,26 +689,3 @@ 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);
-}
diff --git a/src/xt.c b/src/xt.c
index 9680f8ec..3bc38eea 100644
--- a/src/xt.c
+++ b/src/xt.c
@@ -26,78 +26,6 @@
#include <linux/netfilter_arp/arp_tables.h>
#include <linux/netfilter_bridge/ebtables.h>
-void xt_stmt_xlate(const struct stmt *stmt)
-{
- struct xt_xlate *xl = xt_xlate_alloc(10240);
-
- switch (stmt->xt.type) {
- case NFT_XT_MATCH:
- if (stmt->xt.match == NULL && stmt->xt.opts) {
- printf("%s", stmt->xt.opts);
- } else if (stmt->xt.match->xlate) {
- struct xt_xlate_mt_params params = {
- .ip = stmt->xt.entry,
- .match = stmt->xt.match->m,
- .numeric = 0,
- };
-
- stmt->xt.match->xlate(xl, &params);
- printf("%s", xt_xlate_get(xl));
- } else if (stmt->xt.match->print) {
- printf("#");
- stmt->xt.match->print(&stmt->xt.entry,
- stmt->xt.match->m, 0);
- }
- break;
- case NFT_XT_WATCHER:
- case NFT_XT_TARGET:
- if (stmt->xt.target == NULL && stmt->xt.opts) {
- printf("%s", stmt->xt.opts);
- } else if (stmt->xt.target->xlate) {
- struct xt_xlate_tg_params params = {
- .ip = stmt->xt.entry,
- .target = stmt->xt.target->t,
- .numeric = 0,
- };
-
- stmt->xt.target->xlate(xl, &params);
- printf("%s", xt_xlate_get(xl));
- } else if (stmt->xt.target->print) {
- printf("#");
- stmt->xt.target->print(NULL, stmt->xt.target->t, 0);
- }
- break;
- default:
- break;
- }
-
- xt_xlate_free(xl);
-}
-
-void xt_stmt_release(const struct stmt *stmt)
-{
- switch (stmt->xt.type) {
- case NFT_XT_MATCH:
- if (!stmt->xt.match)
- break;
- if (stmt->xt.match->m)
- xfree(stmt->xt.match->m);
- xfree(stmt->xt.match);
- break;
- case NFT_XT_WATCHER:
- case NFT_XT_TARGET:
- if (!stmt->xt.target)
- break;
- if (stmt->xt.target->t)
- xfree(stmt->xt.target->t);
- xfree(stmt->xt.target);
- break;
- default:
- break;
- }
- xfree(stmt->xt.entry);
-}
-
static void *xt_entry_alloc(struct xt_stmt *xt, uint32_t af)
{
union nft_entry {
@@ -215,7 +143,6 @@ void netlink_parse_match(struct netlink_parse_ctx *ctx,
m->u.match_size = mt_len + XT_ALIGN(sizeof(struct xt_entry_match));
m->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_MT_REV);
- stmt = xt_stmt_alloc(loc);
stmt->xt.name = strdup(name);
stmt->xt.type = NFT_XT_MATCH;
stmt->xt.match = xt_match_clone(mt);
@@ -252,7 +179,6 @@ void netlink_parse_target(struct netlink_parse_ctx *ctx,
t->u.user.revision = nftnl_expr_get_u32(nle, NFTNL_EXPR_TG_REV);
strcpy(t->u.user.name, tg->name);
- stmt = xt_stmt_alloc(loc);
stmt->xt.name = strdup(name);
stmt->xt.type = NFT_XT_TARGET;
stmt->xt.target = xt_target_clone(tg);