netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nft: loop optimization
@ 2013-06-19 11:14 Giuseppe Longo
  2013-06-20 12:37 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Giuseppe Longo @ 2013-06-19 11:14 UTC (permalink / raw)
  To: netfilter-devel

This patch prevent in some functions to continue looping after the chain is found.

Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
 iptables/nft.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index d51f2f3..42bf50f 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1275,6 +1275,8 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table)
 
 		__nft_rule_flush(h, table_name, chain_name);
 
+		if (chain != NULL)
+			break;
 next:
 		c = nft_chain_list_iter_next(iter);
 	}
@@ -1390,6 +1392,9 @@ int nft_chain_user_del(struct nft_handle *h, const char *chain, const char *tabl
 			break;
 
 		deleted_ctr++;
+
+		if (chain != NULL)
+			break;
 next:
 		c = nft_chain_list_iter_next(iter);
 	}
@@ -2893,6 +2898,8 @@ int nft_chain_zero_counters(struct nft_handle *h, const char *chain,
 		if (ret < 0)
 			perror("mnl_talk:nft_chain_zero_counters");
 
+		if (chain != NULL)
+			break;
 next:
 		c = nft_chain_list_iter_next(iter);
 	}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nft: loop optimization
  2013-06-19 11:14 [PATCH] nft: loop optimization Giuseppe Longo
@ 2013-06-20 12:37 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-06-20 12:37 UTC (permalink / raw)
  To: Giuseppe Longo; +Cc: netfilter-devel

On Wed, Jun 19, 2013 at 01:14:23PM +0200, Giuseppe Longo wrote:
> This patch prevent in some functions to continue looping after the chain is found.

Applied, thanks Giuseppe!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-20 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 11:14 [PATCH] nft: loop optimization Giuseppe Longo
2013-06-20 12:37 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).