summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");