[iptables PATCH] xtables-save: Fix table not found error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 iptables/xtables-save.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/iptables/xtables-save.c b/iptables/xtables-save.c
index 414a864b6196b..87ebb913f33b7 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;
 	}
 
-- 
2.20.1




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux