From 48a21d5c7af074bd502a4f6fa7d8a46cfa719732 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 25 Sep 2019 18:48:07 +0200 Subject: nft: Support nft_is_table_compatible() per chain When operating on a single chain only, compatibility checking causes unwanted overhead by checking all chains of the current table. Avoid this by accepting the current chain name as parameter and pass it along to nft_chain_list_get(). While being at it, introduce nft_assert_table_compatible() which calls xtables_error() in case compatibility check fails. If a chain name was given, include that in error message. Signed-off-by: Phil Sutter Acked-by: Pablo Neira Ayuso --- iptables/xtables-save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'iptables/xtables-save.c') diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c index e234425d..44687f99 100644 --- a/iptables/xtables-save.c +++ b/iptables/xtables-save.c @@ -77,7 +77,7 @@ __do_output(struct nft_handle *h, const char *tablename, void *data) if (!nft_table_builtin_find(h, tablename)) return 0; - if (!nft_is_table_compatible(h, tablename)) { + if (!nft_is_table_compatible(h, tablename, NULL)) { printf("# Table `%s' is incompatible, use 'nft' tool.\n", tablename); return 0; -- cgit v1.2.3