]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-save: Fix table not found error message
authorPhil Sutter <phil@nwl.cc>
Thu, 7 Feb 2019 21:13:31 +0000 (22:13 +0100)
committerFlorian Westphal <fw@strlen.de>
Fri, 8 Feb 2019 14:12:24 +0000 (15:12 +0100)
First of all, this error message should not appear on stdout, otherwise
it may end in dump files. Next, with completely empty ruleset, even
valid table names cause errors. To avoid this, continue operation if the
not found table is a builtin one.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/xtables-save.c

index 414a864b6196becc23a47fffdf8b6d9ed94e5ff2..87ebb913f33b7fbad2b2c346f3a917953c05282d 100644 (file)
@@ -105,8 +105,9 @@ do_output(struct nft_handle *h, const char *tablename, bool counters)
                return !!ret;
        }
 
-       if (!nft_table_find(h, tablename)) {
-               printf("Table `%s' does not exist\n", tablename);
+       if (!nft_table_find(h, tablename) &&
+           !nft_table_builtin_find(h, tablename)) {
+               fprintf(stderr, "Table `%s' does not exist\n", tablename);
                return 1;
        }