]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: initialize basechains for rule flush command too
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 28 May 2018 18:21:10 +0000 (20:21 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 28 May 2018 21:55:42 +0000 (23:55 +0200)
Otherwise, flush commands on not-yet-initialized basechains hit ENOENT.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c

index 66bd4d42982aa11c73f9cc8bba7a016402e6c40a..603ba306a1ec7872f1b07732ac203f309860b51e 100644 (file)
@@ -1465,6 +1465,9 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table)
        struct nftnl_chain_list_iter *iter;
        struct nftnl_chain *c;
 
+       if (nft_xtables_config_load(h, XTABLES_CONFIG_DEFAULT, 0) < 0)
+               nft_xt_builtin_init(h, table);
+
        nft_fn = nft_rule_flush;
 
        list = nftnl_chain_list_get(h);