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)
This commit is contained in:
Christian S.J. Peron 2004-06-02 21:12:55 +00:00
parent 755e3f9b2e
commit 04f708340a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130013

View File

@ -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)
{