diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-11-12 12:03:57 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-11-12 13:49:21 +0100 |
commit | 21ec111803febfe11693790f44400e3f0a5e2020 (patch) | |
tree | a41be185274ed96b131e8bca7e73f8bcc753bb68 /iptables/nft.c | |
parent | 05947c82232e3a3d20f93a1ba18e35e7f4e23671 (diff) |
nft: replace nft_chain_dump() by nft_chain_list_get()
So we can remove nft_chain_dump() and replace nftnl_chain_get_list().
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r-- | iptables/nft.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/iptables/nft.c b/iptables/nft.c index e2a49024..b75277aa 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -673,9 +673,9 @@ nft_chain_builtin_find(struct builtin_table *t, const char *chain) static void nft_chain_builtin_init(struct nft_handle *h, struct builtin_table *table) { - int i; - struct nftnl_chain_list *list = nft_chain_dump(h); + struct nftnl_chain_list *list = nft_chain_list_get(h); struct nftnl_chain *c; + int i; /* Initialize built-in chains if they don't exist yet */ for (i=0; i < NF_INET_NUMHOOKS && table->chains[i].name != NULL; i++) { @@ -1290,7 +1290,7 @@ err: return MNL_CB_OK; } -static struct nftnl_chain_list *nftnl_chain_list_get(struct nft_handle *h) +struct nftnl_chain_list *nft_chain_list_get(struct nft_handle *h) { char buf[16536]; struct nlmsghdr *nlh; @@ -1321,11 +1321,6 @@ retry: return list; } -struct nftnl_chain_list *nft_chain_dump(struct nft_handle *h) -{ - return nftnl_chain_list_get(h); -} - static const char *policy_name[NF_ACCEPT+1] = { [NF_DROP] = "DROP", [NF_ACCEPT] = "ACCEPT", @@ -1534,7 +1529,7 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table, nft_fn = nft_rule_flush; - list = nftnl_chain_list_get(h); + list = nft_chain_list_get(h); if (list == NULL) { ret = 1; goto err; @@ -1596,7 +1591,7 @@ int nft_chain_user_add(struct nft_handle *h, const char *chain, const char *tabl ret = batch_chain_add(h, NFT_COMPAT_CHAIN_USER_ADD, c); - nft_chain_dump(h); + nft_chain_list_get(h); nftnl_chain_list_add(c, h->chain_cache); @@ -1620,7 +1615,7 @@ int nft_chain_user_del(struct nft_handle *h, const char *chain, nft_fn = nft_chain_user_del; - list = nftnl_chain_list_get(h); + list = nft_chain_list_get(h); if (list == NULL) goto err; @@ -1713,7 +1708,7 @@ nft_chain_find(struct nft_handle *h, const char *table, const char *chain) { struct nftnl_chain_list *list; - list = nftnl_chain_list_get(h); + list = nft_chain_list_get(h); if (list == NULL) return NULL; @@ -2329,7 +2324,7 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table, return 1; } - list = nft_chain_dump(h); + list = nft_chain_list_get(h); iter = nftnl_chain_list_iter_create(list); if (iter == NULL) @@ -2474,7 +2469,7 @@ int nft_rule_list_save(struct nft_handle *h, const char *chain, return 0; } - list = nft_chain_dump(h); + list = nft_chain_list_get(h); /* Dump policies and custom chains first */ if (!rulenum) @@ -3077,7 +3072,7 @@ int nft_chain_zero_counters(struct nft_handle *h, const char *chain, struct nftnl_chain *c; int ret = 0; - list = nftnl_chain_list_get(h); + list = nft_chain_list_get(h); if (list == NULL) goto err; @@ -3234,7 +3229,7 @@ static int nft_are_chains_compatible(struct nft_handle *h, const char *tablename struct nftnl_chain *chain; int ret = 0; - list = nftnl_chain_list_get(h); + list = nft_chain_list_get(h); if (list == NULL) return -1; |