]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: netlink: Remove unused functions.
authorVarsha Rao <rvarsha016@gmail.com>
Wed, 16 Aug 2017 14:18:16 +0000 (19:48 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 17 Aug 2017 10:48:20 +0000 (12:48 +0200)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/netlink.h
src/netlink.c

index 0e1d26b6d5b84dbc3976d2a51733a2c86ec8fd61..4bed0e0b1e94b94683565061a7884eff27e7c86b 100644 (file)
@@ -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);
index 7311149f001a2995eb23ee4a91fc441357e036ab..f6eb08fd8d4189b4fe7b04c1f538a01ac0da74df 100644 (file)
@@ -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;