From 3623c3cd080b2cd1a5bd95f58d50c422f77e129e Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Thu, 22 May 2003 20:53:12 +0000 Subject: fix rule nr handling with -D --- userspace/ebtables2/ebtables.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/userspace/ebtables2/ebtables.c b/userspace/ebtables2/ebtables.c index 27f2ff9..271415c 100644 --- a/userspace/ebtables2/ebtables.c +++ b/userspace/ebtables2/ebtables.c @@ -1292,16 +1292,13 @@ static void delete_rule(int begin, int end) struct ebt_u_entry **u_e, *u_e2; struct ebt_u_entries *entries = to_chain(), *entries2; - if (begin < 0) { - if (begin < entries->nentries) - goto rule_error; + if (begin < 0) begin += entries->nentries + 1; - } if (end < 0) end += entries->nentries + 1; - if (begin > end) -rule_error: + if (begin <= 0 || begin > end || end > entries->nentries) print_error("Sorry, wrong rule numbers"); + if ((begin = check_rule_exists(begin)) == -1 || (end = check_rule_exists(end)) == -1) print_error("Sorry, rule does not exist"); -- cgit v1.2.3