From patchwork Wed Oct 31 09:31:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [iptables-nftables,-,3/5] iptables: nft: Fix -D chain rulenum option Date: Tue, 30 Oct 2012 23:31:06 -0000 From: Tomasz Bursztyka X-Patchwork-Id: 195784 Message-Id: <1351675868-14302-4-git-send-email-tomasz.bursztyka@linux.intel.com> To: netfilter-devel@vger.kernel.org Cc: Tomasz Bursztyka Signed-off-by: Tomasz Bursztyka --- 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); }