svn commit: r273033 - head/sbin/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Mon Oct 13 12:49:05 UTC 2014


Author: melifaro
Date: Mon Oct 13 12:49:04 2014
New Revision: 273033
URL: https://svnweb.freebsd.org/changeset/base/273033

Log:
  Show error when deleting non-existing rule number.
  
  Found by:	Oleg Ginzburg

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Mon Oct 13 11:26:17 2014	(r273032)
+++ head/sbin/ipfw/ipfw2.c	Mon Oct 13 12:49:04 2014	(r273033)
@@ -3009,7 +3009,6 @@ fill_flags_cmd(ipfw_insn *cmd, enum ipfw
 void
 ipfw_delete(char *av[])
 {
-	uint32_t rulenum;
 	int i;
 	int exitval = EX_OK;
 	int do_set = 0;
@@ -3059,7 +3058,15 @@ ipfw_delete(char *av[])
 			if (i != 0) {
 				exitval = EX_UNAVAILABLE;
 				warn("rule %u: setsockopt(IP_FW_XDEL)",
-				    rulenum);
+				    rt.start_rule);
+			} else if (rt.new_set == 0) {
+				exitval = EX_UNAVAILABLE;
+				if (rt.start_rule != rt.end_rule)
+					warnx("no rules rules in %u-%u range",
+					    rt.start_rule, rt.end_rule);
+				else
+					warnx("rule %u not found",
+					    rt.start_rule);
 			}
 		}
 	}


More information about the svn-src-head mailing list