Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2014 12:49:04 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273033 - head/sbin/ipfw
Message-ID:  <201410131249.s9DCn4DK025255@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410131249.s9DCn4DK025255>