diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-04 11:41:10 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-05-05 10:05:44 +0200 |
commit | d1eb4d58729736773d1c5cc106451e2851427850 (patch) | |
tree | 8afb1a872df21b1bcf1f012ccac2586f16258bb7 /iptables/nft.c | |
parent | 09f0d47b213de944303a320a70bf57e143bfed62 (diff) |
iptables-compat: chains are purge out already from table flush
Remove dead code that uses the ancient non-batch netlink API. Chains
are already purged out from table flush.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r-- | iptables/nft.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/iptables/nft.c b/iptables/nft.c index 271269f9..165fb9cf 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -1405,18 +1405,6 @@ int nft_chain_user_add(struct nft_handle *h, const char *chain, const char *tabl #define NLM_F_NONREC 0x100 /* Do not delete recursively */ #endif -static int __nft_chain_del(struct nft_handle *h, struct nftnl_chain *c) -{ - char buf[MNL_SOCKET_BUFFER_SIZE]; - struct nlmsghdr *nlh; - - nlh = nftnl_chain_nlmsg_build_hdr(buf, NFT_MSG_DELCHAIN, h->family, - NLM_F_NONREC | NLM_F_ACK, h->seq); - nftnl_chain_nlmsg_build_payload(nlh, c); - - return mnl_talk(h, nlh, NULL, NULL); -} - int nft_chain_user_del(struct nft_handle *h, const char *chain, const char *table) { struct nftnl_chain_list *list; @@ -1674,39 +1662,6 @@ err: return ret == 0 ? 1 : 0; } -int nft_table_purge_chains(struct nft_handle *h, const char *this_table, - struct nftnl_chain_list *chain_list) -{ - struct nftnl_chain_list_iter *iter; - struct nftnl_chain *chain_obj; - - iter = nftnl_chain_list_iter_create(chain_list); - if (iter == NULL) - return 0; - - chain_obj = nftnl_chain_list_iter_next(iter); - while (chain_obj != NULL) { - const char *table = - nftnl_chain_get_str(chain_obj, NFTNL_CHAIN_TABLE); - - if (strcmp(this_table, table) != 0) - goto next; - - if (nft_chain_builtin(chain_obj)) - goto next; - - if ( __nft_chain_del(h, chain_obj) < 0) { - if (errno != EBUSY) - return -1; - } -next: - chain_obj = nftnl_chain_list_iter_next(iter); - } - nftnl_chain_list_iter_destroy(iter); - - return 0; -} - static int __nft_rule_del(struct nft_handle *h, struct nftnl_rule_list *list, struct nftnl_rule *r) { |