From: Giuseppe Longo <giuseppelng@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [iptables-nftables PATCH v2] src: display rule by number
Date: Fri, 12 Jul 2013 13:27:33 +0200 [thread overview]
Message-ID: <20130712112649.7295.62611.stgit@localhost> (raw)
This patch fixes the display of rule by number.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
---
iptables/nft.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/iptables/nft.c b/iptables/nft.c
index 98d602c..7ff9c70 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2450,19 +2450,19 @@ __nft_rule_list(struct nft_handle *h, struct nft_chain *c, const char *table,
strcmp(chain, rule_chain) != 0)
goto next;
- if (rulenum > 0) {
+ if (rulenum > 0 && rule_ctr != rulenum) {
/* List by rule number case */
- if (rule_ctr != rulenum) {
- rule_ctr++;
- goto next;
- }
- } else {
- struct iptables_command_state cs = {};
- /* Show all rules case */
- nft_rule_to_iptables_command_state(r, &cs);
-
- cb(&cs, r, rule_ctr, format);
+ goto next;
}
+
+ struct iptables_command_state cs = {};
+ /* Show all rules case */
+ nft_rule_to_iptables_command_state(r, &cs);
+
+ cb(&cs, r, rule_ctr, format);
+ if (rulenum > 0 && rule_ctr == rulenum)
+ break;
+
next:
r = nft_rule_list_iter_next(iter);
}
next reply other threads:[~2013-07-12 11:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-12 11:27 Giuseppe Longo [this message]
2013-07-12 11:50 ` [iptables-nftables PATCH v2] src: display rule by number Tomasz Bursztyka
2013-07-15 11:12 ` 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=20130712112649.7295.62611.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).