diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-17 14:55:01 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-12-30 23:50:38 +0100 |
commit | da07c930b9e2aaf8df24022a175b1774aa0bdd8b (patch) | |
tree | d2c864070035c8273e5e9bdca99f9b3815bc9f88 /iptables | |
parent | f77e1aca9aa8851b469f79c2db80ddb6f49253b2 (diff) |
nft: break chain listing if only one if looked for
Break looping on the chain list if it finds the chain
that the user requested.
Based on patch from Tomasz Bursztyka.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables')
-rw-r--r-- | iptables/nft.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/iptables/nft.c b/iptables/nft.c index e6702ff4..2b9598b9 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -2501,6 +2501,10 @@ int nft_rule_list(struct nft_handle *h, const char *chain, const char *table, } __nft_rule_list(h, c, table, rulenum, format, print_firewall); + /* we printed the chain we wanted, stop processing. */ + if (chain) + break; + found = true; next: @@ -2599,6 +2603,10 @@ int nft_rule_list_save(struct nft_handle *h, const char *chain, ret = __nft_rule_list(h, c, table, rulenum, counters ? 0 : FMT_NOCOUNTS, list_save); + + /* we printed the chain we wanted, stop processing. */ + if (chain) + break; next: c = nft_chain_list_iter_next(iter); } |