summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-08-03 15:56:19 +0200
committerFlorian Westphal <fw@strlen.de>2018-08-04 23:30:35 +0200
commit03572549df349455fcade80dfab0b28904975330 (patch)
treed116c11e04a86080157f1185d6d4f96b742b0bdc /iptables
parent206033ede9461e1fc57590c5c1cefdb75235d99d (diff)
xtables: Print error when listing non-existent chains
Just like legacy iptables, iptables-nft should not treat the attempt to list a non-existing chain as OK. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables')
-rw-r--r--iptables/nft.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index f9bd0ed2..154ae19c 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2298,18 +2298,21 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table,
__nft_rule_list(h, chain_name, table,
rulenum, format, ops->print_rule);
+ found = true;
+
/* we printed the chain we wanted, stop processing. */
if (chain)
break;
- found = true;
-
next:
c = nftnl_chain_list_iter_next(iter);
}
nftnl_chain_list_iter_destroy(iter);
err:
+ if (chain && !found)
+ return 0;
+
return 1;
}