iptables: nft: Fix -D chain rulenum option
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/iptables/nft.c b/iptables/nft.c
index 5764ec8..dcc9ec4 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2237,10 +2237,10 @@
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... ");
@@ -2272,6 +2272,7 @@
break;
}
next:
+ rule_ctr++;
r = nft_rule_list_iter_next(iter);
}