]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-compat: remove useless functions
authorPablo M. Bermudo Garay <pablombg@gmail.com>
Sun, 21 Aug 2016 18:10:25 +0000 (20:10 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 22 Aug 2016 09:50:57 +0000 (11:50 +0200)
The static function nft_rule_list_get was exposed outside nft.c through
the nft_rule_list_create function, but this was never used out there.

A similar situation occurs with nftnl_rule_list_free and
nft_rule_list_destroy.

This patch removes nft_rule_list_create and nft_rule_list_destroy for
the sake of simplicity.

Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c
iptables/nft.h

index 05ba57a3a867036bbd1159152ae6209b60dc1bc3..247a60aa1dd87967983b7e91a3b18814ff262e04 100644 (file)
@@ -1766,16 +1766,6 @@ static int __nft_rule_del(struct nft_handle *h, struct nftnl_rule_list *list,
        return 1;
 }
 
-struct nftnl_rule_list *nft_rule_list_create(struct nft_handle *h)
-{
-       return nft_rule_list_get(h);
-}
-
-void nft_rule_list_destroy(struct nftnl_rule_list *list)
-{
-       nftnl_rule_list_free(list);
-}
-
 static struct nftnl_rule *
 nft_rule_find(struct nft_handle *h, struct nftnl_rule_list *list,
              const char *chain, const char *table, void *data, int rulenum)
@@ -1831,7 +1821,7 @@ int nft_rule_check(struct nft_handle *h, const char *chain,
 
        nft_fn = nft_rule_check;
 
-       list = nft_rule_list_create(h);
+       list = nft_rule_list_get(h);
        if (list == NULL)
                return 0;
 
@@ -1839,7 +1829,7 @@ int nft_rule_check(struct nft_handle *h, const char *chain,
        if (ret == 0)
                errno = ENOENT;
 
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
 
        return ret;
 }
@@ -1853,7 +1843,7 @@ int nft_rule_delete(struct nft_handle *h, const char *chain,
 
        nft_fn = nft_rule_delete;
 
-       list = nft_rule_list_create(h);
+       list = nft_rule_list_get(h);
        if (list == NULL)
                return 0;
 
@@ -1865,7 +1855,7 @@ int nft_rule_delete(struct nft_handle *h, const char *chain,
        } else
                errno = ENOENT;
 
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
 
        return ret;
 }
@@ -1906,7 +1896,7 @@ int nft_rule_insert(struct nft_handle *h, const char *chain,
        nft_fn = nft_rule_insert;
 
        if (rulenum > 0) {
-               list = nft_rule_list_create(h);
+               list = nft_rule_list_get(h);
                if (list == NULL)
                        goto err;
 
@@ -1918,7 +1908,7 @@ int nft_rule_insert(struct nft_handle *h, const char *chain,
                        r = nft_rule_find(h, list, chain, table, data,
                                          rulenum - 1);
                        if (r != NULL) {
-                               nft_rule_list_destroy(list);
+                               nftnl_rule_list_free(list);
                                return nft_rule_append(h, chain, table, data,
                                                       0, verbose);
                        }
@@ -1930,12 +1920,12 @@ int nft_rule_insert(struct nft_handle *h, const char *chain,
                handle = nftnl_rule_get_u64(r, NFTNL_RULE_HANDLE);
                DEBUGP("adding after rule handle %"PRIu64"\n", handle);
 
-               nft_rule_list_destroy(list);
+               nftnl_rule_list_free(list);
        }
 
        return nft_rule_add(h, chain, table, data, handle, verbose);
 err:
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
        return 0;
 }
 
@@ -1948,7 +1938,7 @@ int nft_rule_delete_num(struct nft_handle *h, const char *chain,
 
        nft_fn = nft_rule_delete_num;
 
-       list = nft_rule_list_create(h);
+       list = nft_rule_list_get(h);
        if (list == NULL)
                return 0;
 
@@ -1963,7 +1953,7 @@ int nft_rule_delete_num(struct nft_handle *h, const char *chain,
        } else
                errno = ENOENT;
 
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
 
        return ret;
 }
@@ -1977,7 +1967,7 @@ int nft_rule_replace(struct nft_handle *h, const char *chain,
 
        nft_fn = nft_rule_replace;
 
-       list = nft_rule_list_create(h);
+       list = nft_rule_list_get(h);
        if (list == NULL)
                return 0;
 
@@ -1993,7 +1983,7 @@ int nft_rule_replace(struct nft_handle *h, const char *chain,
        } else
                errno = ENOENT;
 
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
 
        return ret;
 }
@@ -2256,7 +2246,7 @@ int nft_rule_zero_counters(struct nft_handle *h, const char *chain,
 
        nft_fn = nft_rule_delete;
 
-       list = nft_rule_list_create(h);
+       list = nft_rule_list_get(h);
        if (list == NULL)
                return 0;
 
@@ -2276,7 +2266,7 @@ int nft_rule_zero_counters(struct nft_handle *h, const char *chain,
                               false);
 
 error:
-       nft_rule_list_destroy(list);
+       nftnl_rule_list_free(list);
 
        return ret;
 }
index 52f213637a2d6b051e46d120ff067f3b0703ea88..bcabf42bf2f85b95cadbd32edd0efb0a1d32fb12 100644 (file)
@@ -92,9 +92,6 @@ int nft_rule_save(struct nft_handle *h, const char *table, bool counters);
 int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table);
 int nft_rule_zero_counters(struct nft_handle *h, const char *chain, const char *table, int rulenum);
 
-struct nftnl_rule_list *nft_rule_list_create(struct nft_handle *h);
-void nft_rule_list_destroy(struct nftnl_rule_list *list);
-
 /*
  * Operations used in userspace tools
  */