summaryrefslogtreecommitdiffstats
path: root/ip6tables.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-11-19 19:01:26 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-11-19 19:01:26 +0100
commit0e6b7d3171988cf745d4d99006459bcea99e6e34 (patch)
tree56b6c0ea4cbf34b7913cd8397b81cee8559977e3 /ip6tables.c
parent03d99486d8283552705b58dc55b6085dffc38792 (diff)
iptables: fix error reporting with wrong/missing arguments
This patch fixes wrong error reporting when arguments are missing: # iptables -I INPUT -m state --state iptables v1.4.2-rc1: Unknown arg `(null)' Try `iptables -h' or 'iptables --help' for more information. or wrong: # iptables -I INPUT -m state --xyz iptables v1.4.2-rc1: Unknown arg `(null)' Try `iptables -h' or 'iptables --help' for more information. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'ip6tables.c')
-rw-r--r--ip6tables.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 293ba37f..3c45c072 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -1888,9 +1888,26 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand
continue;
}
- if (!m)
+ if (!m) {
+ if (c == '?') {
+ if (optopt) {
+ exit_error(
+ PARAMETER_PROBLEM,
+ "option `%s' "
+ "requires an "
+ "argument",
+ argv[optind-1]);
+ } else {
+ exit_error(
+ PARAMETER_PROBLEM,
+ "unknown option "
+ "`%s'",
+ argv[optind-1]);
+ }
+ }
exit_error(PARAMETER_PROBLEM,
"Unknown arg `%s'", optarg);
+ }
}
}
invert = FALSE;