From owner-svn-src-all@FreeBSD.ORG Mon Oct 13 12:49:05 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0625F8AF; Mon, 13 Oct 2014 12:49:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E68B6DEE; Mon, 13 Oct 2014 12:49:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9DCn44c025257; Mon, 13 Oct 2014 12:49:04 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9DCn4DK025255; Mon, 13 Oct 2014 12:49:04 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410131249.s9DCn4DK025255@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 13 Oct 2014 12:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273033 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2014 12:49:05 -0000 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); } } }