From 0b7c22e00622db468846f11809ca0cecc6c7cd97 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 10 Jul 2020 20:08:35 +0200 Subject: nft: Make table creation purely implicit While asserting a required builtin chain exists, its table is created implicitly if missing. Exploit this from xtables-restore, too: The only actions which need adjustment are chain_new and chain_restore, i.e. when restoring (either builtin or custom) chains. Note: The call to nft_table_builtin_add() wasn't sufficient as it doesn't set the table as initialized and therefore a following call to nft_xt_builtin_init() would override non-default base chain policies. Note2: The 'table_new' callback in 'nft_xt_restore_cb' is left in place as xtables-translate uses it to print an explicit 'add table' command. Note3: nft_table_new() function was already unused since a7f1e208cdf9c ("nft: split parsing from netlink commands"). Signed-off-by: Phil Sutter --- iptables/nft-cmd.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'iptables/nft-cmd.c') diff --git a/iptables/nft-cmd.c b/iptables/nft-cmd.c index 51cdfed4..5d33f1f0 100644 --- a/iptables/nft-cmd.c +++ b/iptables/nft-cmd.c @@ -393,8 +393,3 @@ int ebt_cmd_user_chain_policy(struct nft_handle *h, const char *table, return 1; } - -void nft_cmd_table_new(struct nft_handle *h, const char *table) -{ - nft_cmd_new(h, NFT_COMPAT_TABLE_NEW, table, NULL, NULL, -1, false); -} -- cgit v1.2.3