summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}