From d49ba500efd4dc50eef10324f3c0b4f7ce5d6e3e Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 27 Jun 2018 10:21:15 +0200 Subject: xtables-restore: init table before processing policies *filter :INPUT DROP [32:4052] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] -A OUTPUT COMMIT will be restored with ACCEPT policies. When -A OUTPUT is processed, the OUTPUT chain isn't found in the chain cache, so the table is re-created with ACCEPT policies, which overrides the earlier DROP policies. A better fix would be to add the policy setting to the chain cache but it seems we'll need a chain abstraction with refcounting first. Fixes: 01e25e264a4c4 ("xtables: add chain cache") Signed-off-by: Florian Westphal --- iptables/nft.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'iptables/nft.c') diff --git a/iptables/nft.c b/iptables/nft.c index 64307375..b7ee8352 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -1891,6 +1891,12 @@ err_out: return ret == 0 ? 1 : 0; } +void nft_table_new(struct nft_handle *h, const char *table) +{ + if (nft_xtables_config_load(h, XTABLES_CONFIG_DEFAULT, 0) < 0) + nft_xt_builtin_init(h, table); +} + static int __nft_rule_del(struct nft_handle *h, struct nftnl_rule_list *list, struct nftnl_rule *r) { -- cgit v1.2.3