diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-08-03 14:31:06 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-08-03 14:31:06 +0000 |
commit | bcaee5870c1df015d2e70304e0d0fc043a66cfa3 (patch) | |
tree | 00a22f50441b66a277ed815c8b020cb4988910cf /sbin/ipfw | |
parent | 04e6a60087f2bb8f3eebcc2f894981c42ff929ec (diff) | |
download | FreeBSD-src-bcaee5870c1df015d2e70304e0d0fc043a66cfa3.zip FreeBSD-src-bcaee5870c1df015d2e70304e0d0fc043a66cfa3.tar.gz |
Fix ipfw range deletion.
Spotted by: ian,julian
Diffstat (limited to 'sbin/ipfw')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 687d707..5dea974 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -3033,9 +3033,10 @@ fill_flags_cmd(ipfw_insn *cmd, enum ipfw_opcodes opcode, void ipfw_delete(char *av[]) { - int i; + int i, j; int exitval = EX_OK; int do_set = 0; + char *sep; ipfw_range_tlv rt; av++; @@ -3053,7 +3054,11 @@ ipfw_delete(char *av[]) /* Rule number */ while (*av && isdigit(**av)) { - i = atoi(*av); av++; + i = strtol(*av, &sep, 10); + j = i; + if (*sep== '-') + j = strtol(sep + 1, NULL, 10); + av++; if (co.do_nat) { exitval = do_cmd(IP_FW_NAT_DEL, &i, sizeof i); if (exitval) { @@ -3068,7 +3073,7 @@ ipfw_delete(char *av[]) rt.flags = IPFW_RCFLAG_SET; } else { rt.start_rule = i & 0xffff; - rt.end_rule = i & 0xffff; + rt.end_rule = j & 0xffff; if (rt.start_rule == 0 && rt.end_rule == 0) rt.flags |= IPFW_RCFLAG_ALL; else |