svn commit: r286232 - head/sbin/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Mon Aug 3 14:31:07 UTC 2015


Author: melifaro
Date: Mon Aug  3 14:31:06 2015
New Revision: 286232
URL: https://svnweb.freebsd.org/changeset/base/286232

Log:
  Fix ipfw range deletion.
  
  Spotted by:	ian,julian

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Mon Aug  3 13:49:46 2015	(r286231)
+++ head/sbin/ipfw/ipfw2.c	Mon Aug  3 14:31:06 2015	(r286232)
@@ -3033,9 +3033,10 @@ fill_flags_cmd(ipfw_insn *cmd, enum ipfw
 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


More information about the svn-src-head mailing list