* [PATCH nft 1/5] src: Remove xt_stmt_() functions.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
@ 2017-08-16 14:18 ` Varsha Rao
2017-08-16 14:18 ` [PATCH nft 2/5] src: gmputil: Remove mpz_get_be64() function Varsha Rao
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Varsha Rao @ 2017-08-16 14:18 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Varsha Rao
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>
---
include/statement.h | 2 --
include/xt.h | 7 -----
src/statement.c | 23 -----------------
src/xt.c | 74 -----------------------------------------------------
4 files changed, 106 deletions(-)
diff --git a/include/statement.h b/include/statement.h
index 49fb109..61b5027 100644
--- a/include/statement.h
+++ b/include/statement.h
@@ -195,8 +195,6 @@ struct xt_stmt {
void *entry;
};
-extern struct stmt *xt_stmt_alloc(const struct location *loc);
-
/**
* enum stmt_types - statement types
*
diff --git a/include/xt.h b/include/xt.h
index 753511e..dfdf9ee 100644
--- a/include/xt.h
+++ b/include/xt.h
@@ -8,9 +8,6 @@ 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);
@@ -20,9 +17,6 @@ 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,
@@ -35,5 +29,4 @@ static inline void stmt_xt_postprocess(struct rule_pp_ctx *rctx,
struct stmt *stmt, struct rule *rule) {}
#endif
-
#endif /* _NFT_XT_H_ */
diff --git a/src/statement.c b/src/statement.c
index 0ce875e..58f8aaf 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 9680f8e..3bc38ee 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, ¶ms);
- 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, ¶ms);
- 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);
--
2.13.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH nft 2/5] src: gmputil: Remove mpz_get_be64() function.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
2017-08-16 14:18 ` [PATCH nft 1/5] src: Remove xt_stmt_() functions Varsha Rao
@ 2017-08-16 14:18 ` Varsha Rao
2017-08-16 14:18 ` [PATCH nft 3/5] src: cli: Remove cli_display() function Varsha Rao
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Varsha Rao @ 2017-08-16 14:18 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Varsha Rao
mpz_get_be64() is not used anywhere in source code. So remove it.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
include/gmputil.h | 1 -
src/gmputil.c | 5 -----
2 files changed, 6 deletions(-)
diff --git a/include/gmputil.h b/include/gmputil.h
index 1bf696a..9c37221 100644
--- a/include/gmputil.h
+++ b/include/gmputil.h
@@ -45,7 +45,6 @@ extern uint32_t mpz_get_uint32(const mpz_t op);
extern uint16_t mpz_get_uint16(const mpz_t op);
extern uint8_t mpz_get_uint8(const mpz_t op);
-extern uint64_t mpz_get_be64(const mpz_t op);
extern uint32_t mpz_get_be32(const mpz_t op);
extern uint16_t mpz_get_be16(const mpz_t op);
diff --git a/src/gmputil.c b/src/gmputil.c
index 844ea61..3cc4e61 100644
--- a/src/gmputil.c
+++ b/src/gmputil.c
@@ -77,11 +77,6 @@ uint8_t mpz_get_uint8(const mpz_t op)
return mpz_get_type(uint8_t, MPZ_HOST_ENDIAN, op);
}
-uint64_t mpz_get_be64(const mpz_t op)
-{
- return mpz_get_type(uint64_t, MPZ_BIG_ENDIAN, op);
-}
-
uint32_t mpz_get_be32(const mpz_t op)
{
return mpz_get_type(uint32_t, MPZ_BIG_ENDIAN, op);
--
2.13.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH nft 3/5] src: cli: Remove cli_display() function.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
2017-08-16 14:18 ` [PATCH nft 1/5] src: Remove xt_stmt_() functions Varsha Rao
2017-08-16 14:18 ` [PATCH nft 2/5] src: gmputil: Remove mpz_get_be64() function Varsha Rao
@ 2017-08-16 14:18 ` Varsha Rao
2017-08-16 14:18 ` [PATCH nft 4/5] src: netlink: Remove unused functions Varsha Rao
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Varsha Rao @ 2017-08-16 14:18 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Varsha Rao
Remove cli_display() function, as it is not called anywhere in source
code.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
include/cli.h | 1 -
src/cli.c | 26 --------------------------
2 files changed, 27 deletions(-)
diff --git a/include/cli.h b/include/cli.h
index e577400..40fc63e 100644
--- a/include/cli.h
+++ b/include/cli.h
@@ -15,6 +15,5 @@ static inline int cli_init(struct nft_ctx *nft, struct mnl_socket *nf_sock,
}
#endif
extern void cli_exit(void);
-extern void cli_display(const char *fmt, va_list ap) __fmtstring(1, 0);
#endif
diff --git a/src/cli.c b/src/cli.c
index a50fc58..d0ca9af 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -149,32 +149,6 @@ static char **cli_completion(const char *text, int start, int end)
return NULL;
}
-void __fmtstring(1, 0) cli_display(const char *fmt, va_list ap)
-{
- int point, end;
- char *buf;
-
- point = rl_point;
- end = rl_end;
- rl_point = rl_end = 0;
-
- rl_save_prompt();
- rl_clear_message();
-
- if (vasprintf(&buf, fmt, ap) < 0)
- fprintf(rl_outstream, "cli_display: out of memory\n");
- else {
- fprintf(rl_outstream, "%s\n", buf);
- xfree(buf);
- }
-
- rl_restore_prompt();
-
- rl_point = point;
- rl_end = end;
- rl_forced_update_display();
-}
-
int cli_init(struct nft_ctx *nft, struct mnl_socket *nf_sock,
struct nft_cache *cache, struct parser_state *_state)
{
--
2.13.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH nft 4/5] src: netlink: Remove unused functions.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
` (2 preceding siblings ...)
2017-08-16 14:18 ` [PATCH nft 3/5] src: cli: Remove cli_display() function Varsha Rao
@ 2017-08-16 14:18 ` Varsha Rao
2017-08-16 14:18 ` [PATCH nft 5/5] src: mnl: " Varsha Rao
2017-08-19 12:11 ` [PATCH nft 0/5] src: Removes " Pablo Neira Ayuso
5 siblings, 0 replies; 7+ messages in thread
From: Varsha Rao @ 2017-08-16 14:18 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Varsha Rao
Remove netlink_add_rule_list(), netlink_dump_table(),
netlink_get_chain(), netlink_get_set(), netlink_get_table(),
netlink_list_chain() functions definitions as they are not
called anywhere in source code.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
include/netlink.h | 11 ------
src/netlink.c | 104 ------------------------------------------------------
2 files changed, 115 deletions(-)
diff --git a/include/netlink.h b/include/netlink.h
index 0e1d26b..4bed0e0 100644
--- a/include/netlink.h
+++ b/include/netlink.h
@@ -111,8 +111,6 @@ extern int netlink_add_rule(struct netlink_ctx *ctx, const struct handle *h,
const struct rule *rule, uint32_t flags);
extern int netlink_delete_rule(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
-extern int netlink_add_rule_list(struct netlink_ctx *ctx, const struct handle *h,
- const struct list_head *rule_list);
extern int netlink_add_rule_batch(struct netlink_ctx *ctx,
const struct handle *h,
const struct rule *rule, uint32_t flags);
@@ -133,10 +131,6 @@ extern int netlink_delete_chain(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
extern int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
-extern int netlink_get_chain(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc);
-extern int netlink_list_chain(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc);
extern int netlink_flush_chain(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
@@ -147,8 +141,6 @@ extern int netlink_delete_table(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
extern int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
-extern int netlink_get_table(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc, struct table *table);
extern int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
extern int netlink_flush_table(struct netlink_ctx *ctx, const struct handle *h,
@@ -160,8 +152,6 @@ extern int netlink_delete_set(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
extern int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc);
-extern int netlink_get_set(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc);
extern struct stmt *netlink_parse_set_expr(const struct set *set,
const struct nft_cache *cache,
@@ -186,7 +176,6 @@ extern int netlink_add_obj(struct netlink_ctx *ctx, const struct handle *h,
extern int netlink_delete_obj(struct netlink_ctx *ctx, const struct handle *h,
struct location *loc, uint32_t type);
-extern void netlink_dump_table(const struct nftnl_table *nlt);
extern void netlink_dump_chain(const struct nftnl_chain *nlc);
extern void netlink_dump_rule(const struct nftnl_rule *nlr);
extern void netlink_dump_expr(const struct nftnl_expr *nle);
diff --git a/src/netlink.c b/src/netlink.c
index 7311149..f6eb08f 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -486,19 +486,6 @@ int netlink_replace_rule_batch(struct netlink_ctx *ctx, const struct handle *h,
return err;
}
-int netlink_add_rule_list(struct netlink_ctx *ctx, const struct handle *h,
- const struct list_head *rule_list)
-{
- struct rule *rule;
-
- list_for_each_entry(rule, rule_list, list) {
- if (netlink_add_rule_batch(ctx, &rule->handle, rule,
- NLM_F_APPEND) < 0)
- return -1;
- }
- return 0;
-}
-
int netlink_del_rule_batch(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc)
{
@@ -871,35 +858,6 @@ int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h,
strerror(ENOENT));
}
-int netlink_get_chain(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc)
-{
- struct nftnl_chain *nlc;
- struct chain *chain;
- int err;
-
- nlc = alloc_nftnl_chain(h);
- err = mnl_nft_chain_get(ctx->nf_sock, nlc, 0, ctx->seqnum);
- if (err < 0) {
- netlink_io_error(ctx, loc,
- "Could not receive chain from kernel: %s",
- strerror(errno));
- goto out;
- }
-
- chain = netlink_delinearize_chain(ctx, nlc);
- list_add_tail(&chain->list, &ctx->list);
-out:
- nftnl_chain_free(nlc);
- return err;
-}
-
-int netlink_list_chain(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc)
-{
- return netlink_list_rules(ctx, h, loc);
-}
-
int netlink_flush_chain(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc)
{
@@ -1000,19 +958,6 @@ int netlink_delete_table(struct netlink_ctx *ctx, const struct handle *h,
return netlink_del_table_compat(ctx, h, loc);
}
-void netlink_dump_table(const struct nftnl_table *nlt)
-{
-#ifdef DEBUG
- char buf[4096];
-
- if (!(debug_level & DEBUG_NETLINK))
- return;
-
- nftnl_table_snprintf(buf, sizeof(buf), nlt, 0, 0);
- fprintf(stdout, "%s\n", buf);
-#endif
-}
-
static struct table *netlink_delinearize_table(struct netlink_ctx *ctx,
const struct nftnl_table *nlt)
{
@@ -1055,30 +1000,6 @@ int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
return 0;
}
-int netlink_get_table(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc, struct table *table)
-{
- struct nftnl_table *nlt;
- struct table *ntable;
- int err;
-
- nlt = alloc_nftnl_table(h);
- err = mnl_nft_table_get(ctx->nf_sock, nlt, 0, ctx->seqnum);
- if (err < 0) {
- netlink_io_error(ctx, loc,
- "Could not receive table from kernel: %s",
- strerror(errno));
- goto out;
- }
-
- ntable = netlink_delinearize_table(ctx, nlt);
- table->flags = ntable->flags;
- table_free(ntable);
-out:
- nftnl_table_free(nlt);
- return err;
-}
-
int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h,
const struct location *loc)
{
@@ -1418,31 +1339,6 @@ int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h,
return err;
}
-int netlink_get_set(struct netlink_ctx *ctx, const struct handle *h,
- const struct location *loc)
-{
- struct nftnl_set *nls;
- struct set *set;
- int err;
-
- nls = alloc_nftnl_set(h);
- err = mnl_nft_set_get(ctx->nf_sock, nls, ctx->seqnum);
- if (err < 0) {
- nftnl_set_free(nls);
- return netlink_io_error(ctx, loc,
- "Could not receive set from kernel: %s",
- strerror(errno));
- }
-
- set = netlink_delinearize_set(ctx, nls);
- nftnl_set_free(nls);
- if (set == NULL)
- return -1;
- list_add_tail(&set->list, &ctx->list);
-
- return err;
-}
-
static void alloc_setelem_cache(const struct expr *set, struct nftnl_set *nls)
{
struct nftnl_set_elem *nlse;
--
2.13.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH nft 5/5] src: mnl: Remove unused functions.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
` (3 preceding siblings ...)
2017-08-16 14:18 ` [PATCH nft 4/5] src: netlink: Remove unused functions Varsha Rao
@ 2017-08-16 14:18 ` Varsha Rao
2017-08-19 12:11 ` [PATCH nft 0/5] src: Removes " Pablo Neira Ayuso
5 siblings, 0 replies; 7+ messages in thread
From: Varsha Rao @ 2017-08-16 14:18 UTC (permalink / raw)
To: pablo, netfilter-devel; +Cc: Varsha Rao
Functions mnl_nft_chain_get(), mnl_nft_rule_add(),
mnl_nft_rule_delete(), mnl_nft_set_get(), mnl_nft_table_get(),
set_get_cb(), table_get_cb() and chain_get_cb() are only defined
but not used, so remove them.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
include/mnl.h | 10 -------
src/mnl.c | 94 -----------------------------------------------------------
2 files changed, 104 deletions(-)
diff --git a/include/mnl.h b/include/mnl.h
index 7df0823..affbf74 100644
--- a/include/mnl.h
+++ b/include/mnl.h
@@ -33,10 +33,6 @@ int mnl_nft_rule_batch_del(struct nftnl_rule *nlr, struct nftnl_batch *batch,
int mnl_nft_rule_batch_replace(struct nftnl_rule *nlr, struct nftnl_batch *batch,
unsigned int flags, uint32_t seqnum);
-int mnl_nft_rule_add(struct mnl_socket *nf_sock, struct nftnl_rule *r,
- unsigned int flags, uint32_t seqnum);
-int mnl_nft_rule_delete(struct mnl_socket *nf_sock, struct nftnl_rule *r,
- unsigned int flags, uint32_t seqnum);
struct nftnl_rule_list *mnl_nft_rule_dump(struct mnl_socket *nf_sock,
int family, uint32_t seqnum);
@@ -50,8 +46,6 @@ int mnl_nft_chain_batch_del(struct nftnl_chain *nlc, struct nftnl_batch *batch,
unsigned int flags, uint32_t seqnum);
struct nftnl_chain_list *mnl_nft_chain_dump(struct mnl_socket *nf_sock,
int family, uint32_t seqnum);
-int mnl_nft_chain_get(struct mnl_socket *nf_sock, struct nftnl_chain *nlc,
- unsigned int flags, uint32_t seqnum);
int mnl_nft_table_add(struct mnl_socket *nf_sock, struct nftnl_table *nlt,
unsigned int flags, uint32_t seqnum);
@@ -63,8 +57,6 @@ int mnl_nft_table_batch_del(struct nftnl_table *nlt, struct nftnl_batch *batch,
unsigned int flags, uint32_t seqnum);
struct nftnl_table_list *mnl_nft_table_dump(struct mnl_socket *nf_sock,
int family, uint32_t seqnum);
-int mnl_nft_table_get(struct mnl_socket *nf_sock, struct nftnl_table *nlt,
- unsigned int flags, uint32_t seqnum);
int mnl_nft_set_add(struct mnl_socket *nf_sock, struct nftnl_set *nls,
unsigned int flags, uint32_t seqnum);
@@ -76,8 +68,6 @@ int mnl_nft_set_batch_del(struct nftnl_set *nls, struct nftnl_batch *batch,
unsigned int flags, uint32_t seqnum);
struct nftnl_set_list *mnl_nft_set_dump(struct mnl_socket *nf_sock, int family,
const char *table, uint32_t seqnum);
-int mnl_nft_set_get(struct mnl_socket *nf_sock, struct nftnl_set *nls,
- uint32_t seqnum);
int mnl_nft_setelem_add(struct mnl_socket *nf_sock, struct nftnl_set *nls,
unsigned int flags, uint32_t seqnum);
diff --git a/src/mnl.c b/src/mnl.c
index b0f5191..f5859c9 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -336,33 +336,6 @@ int mnl_nft_rule_batch_del(struct nftnl_rule *nlr, struct nftnl_batch *batch,
/*
* Rule
*/
-int mnl_nft_rule_add(struct mnl_socket *nf_sock, struct nftnl_rule *nlr,
- unsigned int flags, uint32_t seqnum)
-{
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
-
- nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_NEWRULE,
- nftnl_rule_get_u32(nlr, NFTNL_RULE_FAMILY),
- NLM_F_ACK | NLM_F_CREATE | flags, seqnum);
- nftnl_rule_nlmsg_build_payload(nlh, nlr);
-
- return nft_mnl_talk(nf_sock, nlh, nlh->nlmsg_len, seqnum, NULL, NULL);
-}
-
-int mnl_nft_rule_delete(struct mnl_socket *nf_sock, struct nftnl_rule *nlr,
- unsigned int flags, uint32_t seqnum)
-{
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
-
- nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_DELRULE,
- nftnl_rule_get_u32(nlr, NFTNL_RULE_FAMILY),
- NLM_F_ACK, seqnum);
- nftnl_rule_nlmsg_build_payload(nlh, nlr);
-
- return nft_mnl_talk(nf_sock, nlh, nlh->nlmsg_len, seqnum, NULL, NULL);
-}
static int rule_cb(const struct nlmsghdr *nlh, void *data)
{
@@ -524,27 +497,6 @@ err:
return NULL;
}
-static int chain_get_cb(const struct nlmsghdr *nlh, void *data)
-{
- nftnl_chain_nlmsg_parse(nlh, data);
- return MNL_CB_OK;
-}
-
-int mnl_nft_chain_get(struct mnl_socket *nf_sock, struct nftnl_chain *nlc,
- unsigned int flags, uint32_t seqnum)
-{
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
-
- nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_GETCHAIN,
- nftnl_chain_get_u32(nlc, NFTNL_CHAIN_FAMILY),
- seqnum, NLM_F_ACK | flags);
- nftnl_chain_nlmsg_build_payload(nlh, nlc);
-
- return nft_mnl_talk(nf_sock, nlh, nlh->nlmsg_len, seqnum, chain_get_cb,
- nlc);
-}
-
/*
* Table
*/
@@ -655,29 +607,6 @@ err:
return NULL;
}
-static int table_get_cb(const struct nlmsghdr *nlh, void *data)
-{
- struct nftnl_table *t = data;
-
- nftnl_table_nlmsg_parse(nlh, t);
- return MNL_CB_OK;
-}
-
-int mnl_nft_table_get(struct mnl_socket *nf_sock, struct nftnl_table *nlt,
- unsigned int flags, uint32_t seqnum)
-{
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
-
- nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_GETTABLE,
- nftnl_table_get_u32(nlt, NFTNL_TABLE_FAMILY),
- NLM_F_ACK, seqnum);
- nftnl_table_nlmsg_build_payload(nlh, nlt);
-
- return nft_mnl_talk(nf_sock, nlh, nlh->nlmsg_len, seqnum, table_get_cb,
- nlt);
-}
-
/*
* Set
*/
@@ -906,29 +835,6 @@ err:
return NULL;
}
-static int set_get_cb(const struct nlmsghdr *nlh, void *data)
-{
- struct nftnl_set *s = data;
-
- nftnl_set_nlmsg_parse(nlh, s);
- return MNL_CB_OK;
-}
-
-int mnl_nft_set_get(struct mnl_socket *nf_sock, struct nftnl_set *nls,
- uint32_t seqnum)
-{
- char buf[MNL_SOCKET_BUFFER_SIZE];
- struct nlmsghdr *nlh;
-
- nlh = nftnl_nlmsg_build_hdr(buf, NFT_MSG_GETSET,
- nftnl_set_get_u32(nls, NFTNL_SET_FAMILY),
- NLM_F_ACK, seqnum);
- nftnl_set_nlmsg_build_payload(nlh, nls);
-
- return nft_mnl_talk(nf_sock, nlh, nlh->nlmsg_len, seqnum, set_get_cb,
- nls);
-}
-
/*
* Set elements
*/
--
2.13.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH nft 0/5] src: Removes unused functions.
2017-08-16 14:18 [PATCH nft 0/5] src: Removes unused functions Varsha Rao
` (4 preceding siblings ...)
2017-08-16 14:18 ` [PATCH nft 5/5] src: mnl: " Varsha Rao
@ 2017-08-19 12:11 ` Pablo Neira Ayuso
5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2017-08-19 12:11 UTC (permalink / raw)
To: Varsha Rao; +Cc: netfilter-devel
On Wed, Aug 16, 2017 at 07:48:12PM +0530, Varsha Rao wrote:
> This patch set removes structure xt_stmt_ops and the following
> functions, as they are not used.
Series applied, thanks Varsha.
Please, follow up with patches in case there is any fallout from this
update.
^ permalink raw reply [flat|nested] 7+ messages in thread