diff options
author | Christian S.J. Peron <csjp@FreeBSD.org> | 2004-06-02 21:12:55 +0000 |
---|---|---|
committer | Christian S.J. Peron <csjp@FreeBSD.org> | 2004-06-02 21:12:55 +0000 |
commit | 04f708340a89e1d241618eb51d58568a644bfcb2 (patch) | |
tree | 7bc09df8513257b8fe601538ed96e5b3553114b3 /sbin/ipfw/ipfw2.c | |
parent | 755e3f9b2e13d09d8a1878a0e8e0e10d02cb12e6 (diff) | |
download | src-04f708340a89e1d241618eb51d58568a644bfcb2.tar.gz src-04f708340a89e1d241618eb51d58568a644bfcb2.zip |
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)
Notes
Notes:
svn path=/head/; revision=130013
Diffstat (limited to 'sbin/ipfw/ipfw2.c')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index e3108ff36fea..b2e4d107ee17 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) { |