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