From patchwork Wed Oct 31 09:31:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Bursztyka X-Patchwork-Id: 195784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0E5442C018B for ; Wed, 31 Oct 2012 20:31:18 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933430Ab2JaJbQ (ORCPT ); Wed, 31 Oct 2012 05:31:16 -0400 Received: from mga03.intel.com ([143.182.124.21]:33152 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932190Ab2JaJbP (ORCPT ); Wed, 31 Oct 2012 05:31:15 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 31 Oct 2012 02:31:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,687,1344236400"; d="scan'208";a="162786551" Received: from rd-180.fi.intel.com ([10.237.68.32]) by AZSMGA002.ch.intel.com with ESMTP; 31 Oct 2012 02:31:14 -0700 From: Tomasz Bursztyka To: netfilter-devel@vger.kernel.org Cc: Tomasz Bursztyka Subject: [iptables-nftables - PATCH 3/5] iptables: nft: Fix -D chain rulenum option Date: Wed, 31 Oct 2012 11:31:06 +0200 Message-Id: <1351675868-14302-4-git-send-email-tomasz.bursztyka@linux.intel.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1351675868-14302-1-git-send-email-tomasz.bursztyka@linux.intel.com> References: <1351675868-14302-1-git-send-email-tomasz.bursztyka@linux.intel.com> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org 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); }