|
|
ba7f2e |
From 923b64e4003f4bbf50ae1b73504bd45dd55edd9b Mon Sep 17 00:00:00 2001
|
|
|
ba7f2e |
From: Phil Sutter <phil@nwl.cc>
|
|
|
ba7f2e |
Date: Thu, 7 Feb 2019 22:13:31 +0100
|
|
|
ba7f2e |
Subject: [PATCH] xtables-save: Fix table not found error message
|
|
|
ba7f2e |
|
|
|
ba7f2e |
First of all, this error message should not appear on stdout, otherwise
|
|
|
ba7f2e |
it may end in dump files. Next, with completely empty ruleset, even
|
|
|
ba7f2e |
valid table names cause errors. To avoid this, continue operation if the
|
|
|
ba7f2e |
not found table is a builtin one.
|
|
|
ba7f2e |
|
|
|
ba7f2e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
ba7f2e |
Signed-off-by: Florian Westphal <fw@strlen.de>
|
|
|
ba7f2e |
(cherry picked from commit 2478b6cbb8112f940cec61ec1e62a598472d33d0)
|
|
|
ba7f2e |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
ba7f2e |
---
|
|
|
ba7f2e |
iptables/xtables-save.c | 5 +++--
|
|
|
ba7f2e |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
ba7f2e |
|
|
|
ba7f2e |
diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
|
|
|
ba7f2e |
index 414a864b6196b..87ebb913f33b7 100644
|
|
|
ba7f2e |
--- a/iptables/xtables-save.c
|
|
|
ba7f2e |
+++ b/iptables/xtables-save.c
|
|
|
ba7f2e |
@@ -105,8 +105,9 @@ do_output(struct nft_handle *h, const char *tablename, bool counters)
|
|
|
ba7f2e |
return !!ret;
|
|
|
ba7f2e |
}
|
|
|
ba7f2e |
|
|
|
ba7f2e |
- if (!nft_table_find(h, tablename)) {
|
|
|
ba7f2e |
- printf("Table `%s' does not exist\n", tablename);
|
|
|
ba7f2e |
+ if (!nft_table_find(h, tablename) &&
|
|
|
ba7f2e |
+ !nft_table_builtin_find(h, tablename)) {
|
|
|
ba7f2e |
+ fprintf(stderr, "Table `%s' does not exist\n", tablename);
|
|
|
ba7f2e |
return 1;
|
|
|
ba7f2e |
}
|
|
|
ba7f2e |
|
|
|
ba7f2e |
--
|
|
|
ba7f2e |
2.21.0
|
|
|
ba7f2e |
|