netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To: netfilter-devel@vger.kernel.org
Cc: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Subject: [iptables-nftables - PATCH 3/5] iptables: nft: Fix -D chain rulenum option
Date: Wed, 31 Oct 2012 11:31:06 +0200	[thread overview]
Message-ID: <1351675868-14302-4-git-send-email-tomasz.bursztyka@linux.intel.com> (raw)
In-Reply-To: <1351675868-14302-1-git-send-email-tomasz.bursztyka@linux.intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 iptables/nft.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index 0454725..dfbffc7 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2231,10 +2231,10 @@ __nft_rule_check(struct nft_handle *h, const char *chain, const char *table,
 
 		if (rulenum >= 0) {
 			/* Delete by rule number case */
-			if (rule_ctr != rulenum) {
-				rule_ctr++;
+			if (rule_ctr != rulenum)
 				goto next;
-			}
+			found = true;
+			break;
 		} else {
 			/* Delete by matching rule case */
 			DEBUGP("comparing with... ");
@@ -2266,6 +2266,7 @@ __nft_rule_check(struct nft_handle *h, const char *chain, const char *table,
 			break;
 		}
 next:
+		rule_ctr++;
 		r = nft_rule_list_iter_next(iter);
 	}
 
-- 
1.7.12.4


  parent reply	other threads:[~2012-10-31  9:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31  9:31 [iptables-nftables - PATCH 0/5] Support for -E and -R options Tomasz Bursztyka
2012-10-31  9:31 ` [iptables-nftables - PATCH 1/5] headers: Make nf_tables.h up to date Tomasz Bursztyka
2012-10-31  9:31 ` [iptables-nftables - PATCH 2/5] nft: Add support for chain rename options (-E) Tomasz Bursztyka
2012-10-31  9:31 ` Tomasz Bursztyka [this message]
2012-10-31  9:31 ` [iptables-nftables - PATCH 4/5] iptables: nft: Refactor __nft_rule_check to return rule handle when relevant Tomasz Bursztyka
2012-10-31  9:31 ` [iptables-nftables - PATCH 5/5] iptables: nft: Add support for -R option Tomasz Bursztyka
2012-11-01 15:41 ` [iptables-nftables - PATCH 0/5] Support for -E and -R options 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=1351675868-14302-4-git-send-email-tomasz.bursztyka@linux.intel.com \
    --to=tomasz.bursztyka@linux.intel.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).