summaryrefslogtreecommitdiff
path: root/src/conntrack.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-08-12 12:59:32 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2008-08-12 12:59:32 +0200
commit064f0d6da31e9dd5a18da77a9dcf9938746a0c48 (patch)
treeaf7fea940f38bb4d700dd7513c189cb4bc7f9696 /src/conntrack.c
parentd8df7a62cf50cc1af868b22e4d301a78e7f5c450 (diff)
downloadconntrack-tools-064f0d6da31e9dd5a18da77a9dcf9938746a0c48.tar.gz
conntrack-tools-064f0d6da31e9dd5a18da77a9dcf9938746a0c48.zip
cli: remove duplicated optarg checking
Remove duplicated optarg checkings for options that require mandatory paramaters. This checking is already done by getopt_long(). Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/conntrack.c')
-rw-r--r--src/conntrack.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/conntrack.c b/src/conntrack.c
index cc19b5d..36a317a 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -964,10 +964,6 @@ int main(int argc, char *argv[])
case 'd':
case 'r':
case 'q':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires an IP", c);
-
options |= opt2type[c];
l3protonum = parse_addr(optarg, &ad);
@@ -987,10 +983,6 @@ int main(int argc, char *argv[])
case '}':
case '[':
case ']':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires an IP", c);
-
options |= opt2type[c];
l3protonum = parse_addr(optarg, &ad);
set_family(&family, l3protonum);
@@ -1006,10 +998,6 @@ int main(int argc, char *argv[])
nfct_set_attr_u8(mask, ATTR_ORIG_L3PROTO, l3protonum);
break;
case 'p':
- if (!optarg || !*optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires a valid protocol", c);
-
options |= CT_OPT_PROTO;
h = findproto(optarg);
if (!h)
@@ -1022,44 +1010,24 @@ int main(int argc, char *argv[])
exit_error(OTHER_PROBLEM, "out of memory");
break;
case 't':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires value", c);
-
options |= CT_OPT_TIMEOUT;
nfct_set_attr_u32(obj, ATTR_TIMEOUT, atol(optarg));
nfexp_set_attr_u32(exp, ATTR_EXP_TIMEOUT, atol(optarg));
break;
case 'u':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires type", c);
-
options |= CT_OPT_STATUS;
parse_parameter(optarg, &status, PARSE_STATUS);
nfct_set_attr_u32(obj, ATTR_STATUS, status);
break;
case 'e':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires type", c);
-
options |= CT_OPT_EVENT_MASK;
parse_parameter(optarg, &event_mask, PARSE_EVENT);
break;
case 'o':
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires type", c);
-
options |= CT_OPT_OUTPUT;
parse_parameter(optarg, &output_mask, PARSE_OUTPUT);
break;
case 'z':
- if (optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c does not require parameters",c);
-
options |= CT_OPT_ZERO;
break;
case 'n':
@@ -1085,10 +1053,6 @@ int main(int argc, char *argv[])
case 'm':
case 'c':
options |= opt2type[c];
- if (!optarg)
- exit_error(PARAMETER_PROBLEM,
- "-%c requires value", c);
-
nfct_set_attr_u32(obj,
opt2attr[c],
strtoul(optarg, NULL, 0));