path: root/iptables/xtables-save.c
diff options
authorPhil Sutter <>2019-02-07 22:13:31 +0100
committerFlorian Westphal <>2019-02-08 15:12:24 +0100
commit2478b6cbb8112f940cec61ec1e62a598472d33d0 (patch)
treef43262c378cca0504284dccf665b5890c69c9c99 /iptables/xtables-save.c
parent932d5c3fb94acc499c8a6264e354ab1e33316b72 (diff)
xtables-save: Fix table not found error message
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 <> Signed-off-by: Florian Westphal <>
Diffstat (limited to 'iptables/xtables-save.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index 414a864b..87ebb913 100644
--- a/iptables/xtables-save.c
+++ b/iptables/xtables-save.c
@@ -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;