summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-25 00:05:56 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-11-25 00:05:56 +0000
commit1ae9d05173a5960eaf84dcb55b91374fa2bb6639 (patch)
tree0b82d974ee07015fe307ca213c88253252a57d51 /options.c
parentd5badcf116fcf744a8c99ffcdade6ebb48f56872 (diff)
downloadopenvpn-1ae9d05173a5960eaf84dcb55b91374fa2bb6639.tar.gz
openvpn-1ae9d05173a5960eaf84dcb55b91374fa2bb6639.tar.xz
openvpn-1ae9d05173a5960eaf84dcb55b91374fa2bb6639.zip
Added --connect-timeout option to control the timeout
on TCP client connection attempts (doesn't work on all OSes). This patch also makes OpenVPN signalable during TCP connection attempts. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@823 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'options.c')
-rw-r--r--options.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/options.c b/options.c
index b825a1a..72e2f4f 100644
--- a/options.c
+++ b/options.c
@@ -94,7 +94,8 @@ static const char usage_message[] =
"--proto p : Use protocol p for communicating with peer.\n"
" p = udp (default), tcp-server, or tcp-client\n"
"--connect-retry n : For --proto tcp-client, number of seconds to wait\n"
- " between connection retries (default=%d).\n"
+ " between connection retries (default=%d).\n"
+ "--connect-timeout n : For --proto tcp-client, connection timeout (in seconds).\n"
"--connect-retry-max n : Maximum connection attempt retries, default infinite.\n"
#ifdef ENABLE_HTTP_PROXY
"--http-proxy s p [up] [auth] : Connect to remote host through an HTTP proxy at\n"
@@ -598,6 +599,7 @@ init_options (struct options *o)
o->topology = TOP_NET30;
o->proto = PROTO_UDPv4;
o->connect_retry_seconds = 5;
+ o->connect_timeout = 10;
o->connect_retry_max = 0;
o->local_port = o->remote_port = OPENVPN_PORT;
o->verbosity = 1;
@@ -1099,6 +1101,7 @@ show_settings (const struct options *o)
SHOW_INT (resolve_retry_seconds);
SHOW_INT (connect_retry_seconds);
+ SHOW_INT (connect_timeout);
SHOW_INT (connect_retry_max);
SHOW_STR (username);
@@ -1381,6 +1384,9 @@ options_postprocess (struct options *options, bool first_time)
if (options->connect_retry_defined && options->proto != PROTO_TCPv4_CLIENT)
msg (M_USAGE, "--connect-retry doesn't make sense unless also used with --proto tcp-client");
+ if (options->connect_timeout_defined && options->proto != PROTO_TCPv4_CLIENT)
+ msg (M_USAGE, "--connect-timeout doesn't make sense unless also used with --proto tcp-client");
+
/*
* Sanity check on MTU parameters
*/
@@ -3240,6 +3246,12 @@ add_option (struct options *options,
options->connect_retry_seconds = positive_atoi (p[1]);
options->connect_retry_defined = true;
}
+ else if (streq (p[0], "connect-timeout") && p[1])
+ {
+ VERIFY_PERMISSION (OPT_P_GENERAL);
+ options->connect_timeout = positive_atoi (p[1]);
+ options->connect_timeout_defined = true;
+ }
else if (streq (p[0], "connect-retry-max") && p[1])
{
VERIFY_PERMISSION (OPT_P_GENERAL);