summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2004-06-02 21:12:55 +0000
committercsjp <csjp@FreeBSD.org>2004-06-02 21:12:55 +0000
commit77c46c25ea46aa8cdd333c9104a8d61cebca86b3 (patch)
tree7bc09df8513257b8fe601538ed96e5b3553114b3 /sbin/ipfw
parent44e8bf5a4175f7d632bab6747b9c7ee110ff5b58 (diff)
downloadFreeBSD-src-77c46c25ea46aa8cdd333c9104a8d61cebca86b3.zip
FreeBSD-src-77c46c25ea46aa8cdd333c9104a8d61cebca86b3.tar.gz
o Move NEED1 macro to the top of the source file.
o Add sanity checking to the firewall delete operation which tells the user that a firewall rule specification is required. The previous behaviour was to exit without reporting any errors to the user. Approved by: bmilekic (mentor)
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index e3108ff..b2e4d10 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -70,6 +70,11 @@ int
verbose;
#define IP_MASK_ALL 0xffffffff
+/*
+ * the following macro returns an error message if we run out of
+ * arguments.
+ */
+#define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);}
/*
* _s_x is a structure that stores a string <-> token pairs, used in
@@ -2122,6 +2127,7 @@ delete(int ac, char *av[])
memset(&p, 0, sizeof p);
av++; ac--;
+ NEED1("missing rule specification");
if (ac > 0 && !strncmp(*av, "set", strlen(*av))) {
do_set = 1; /* delete set */
ac--; av++;
@@ -2179,12 +2185,6 @@ fill_iface(ipfw_insn_if *cmd, char *arg)
errx(EX_DATAERR, "bad ip address ``%s''", arg);
}
-/*
- * the following macro returns an error message if we run out of
- * arguments.
- */
-#define NEED1(msg) {if (!ac) errx(EX_USAGE, msg);}
-
static void
config_pipe(int ac, char **av)
{
OpenPOWER on IntegriCloud