diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2019-04-27 14:02:01 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2019-04-27 14:02:01 +0200 |
commit | 29dc1ad33679f06c192ee03a3639939307e5f3ea (patch) | |
tree | c8ebbc289d7197b1f47d11daa92e3aa3f6d4437c | |
parent | 1d0cbc46e800919aace83b0a24034b0460382f91 (diff) |
removed `--libpcap` default device, since it is highly os dependant
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | src/options.c | 14 | ||||
-rw-r--r-- | src/ptunnel.c | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/options.c b/src/options.c index ffb5339..79c11ec 100644 --- a/src/options.c +++ b/src/options.c @@ -107,7 +107,7 @@ static const struct option_usage usage[] = { "The special level 5 (or higher) includes xfer logging (lots of output)\n" }, /** --libpcap */ - {"interface", 0, OPT_STR, {.str = "eth0"}, + {"interface", 0, OPT_STR, {.str = NULL}, #ifndef HAVE_PCAP "(Not available on this platform.)\n" #endif @@ -250,8 +250,11 @@ static struct option long_options[] = { static const void *get_default_optval(enum option_type opttype, const char *optname) { for (unsigned i = 0; i < ARRAY_SIZE(long_options); ++i) { - if (strncmp(long_options[i].name, optname, BUFSIZ /* not optimal */) == 0) { - assert(usage[i].otype == opttype); + if (strncmp(long_options[i].name, optname, BUFSIZ /* not optimal */) == 0 && + strlen(long_options[i].name) == strlen(optname)) + { + assert(usage[i].otype == opttype && + (usage[i].otype != OPT_STR || usage[i].str)); return &usage[i].str; } } @@ -274,9 +277,6 @@ static void set_options_defaults(void) { opts.given_dst_port = *(uint32_t *) get_default_optval(OPT_DEC32, "remote-port"); opts.max_tunnels = *(uint32_t *) get_default_optval(OPT_DEC32, "connections"); opts.log_level = *(int *) get_default_optval(OPT_DEC32, "verbosity"); -#ifdef HAVE_PCAP - opts.pcap_device = strdup(*(char **)get_default_optval(OPT_STR, "libpcap")); -#endif opts.log_path = strdup(*(char **)get_default_optval(OPT_STR, "logfile")); opts.log_file = stdout; opts.print_stats = *(int *) get_default_optval(OPT_BOOL, "statistics"); @@ -421,7 +421,7 @@ int parse_options(int argc, char **argv) { * since you have to pass long options as '--option=value'. Commonly used * '--option value' is *NOT* allowed for some libc implementations. */ - c = getopt_long(argc, argv, "m:p:l:r::R::c:v:L::o::sP:d::Su::g::C::e::w:a:t:y:E:h", &long_options[0], &oidx); + c = getopt_long(argc, argv, "m:p:l:r::R::c:v:L:o::sP:d::Su::g::C::e::w:a:t:y:E:h", &long_options[0], &oidx); if (c == -1) break; switch (c) { diff --git a/src/ptunnel.c b/src/ptunnel.c index d70edce..4b3816d 100644 --- a/src/ptunnel.c +++ b/src/ptunnel.c @@ -252,8 +252,8 @@ int main(int argc, char *argv[]) { } #endif /* !WIN32 */ - pthread_mutex_init(&chain_lock, 0); - pthread_mutex_init(&num_threads_lock, 0); + pthread_mutex_init(&chain_lock, 0); + pthread_mutex_init(&num_threads_lock, 0); // Check mode, validate arguments and start either client or proxy. if (opts.mode == kMode_forward) { |