From: Giuseppe Longo <giuseppelng@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] nft: loop optimization
Date: Wed, 19 Jun 2013 13:14:23 +0200 [thread overview]
Message-ID: <20130619111423.7135.60976.stgit@localhost> (raw)
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);
}
next reply other threads:[~2013-06-19 11:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 11:14 Giuseppe Longo [this message]
2013-06-20 12:37 ` [PATCH] nft: loop optimization Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130619111423.7135.60976.stgit@localhost \
--to=giuseppelng@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).