summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2003-05-22 20:53:12 +0000
committerBart De Schuymer <bdschuym@pandora.be>2003-05-22 20:53:12 +0000
commit3623c3cd080b2cd1a5bd95f58d50c422f77e129e (patch)
treeedb5535f3b00f0c88daabf968e975009cdbc2bc0
parentecd80721b550f01bb7197a5708b86ac25afd05ea (diff)
fix rule nr handling with -D
-rw-r--r--userspace/ebtables2/ebtables.c9
1 files 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");