diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-06-29 18:57:21 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2006-06-29 18:57:21 +0000 |
commit | e482a63238d3085e96fa698b1c45cf54357038b4 (patch) | |
tree | 687dfbd60abb4ef6c5a2017af0d21394730a3699 /socket.c | |
parent | Minor syshead.h change for NetBSD to allow (diff) | |
download | openvpn-e482a63238d3085e96fa698b1c45cf54357038b4.tar.xz |
Added two new management states:
OPENVPN_STATE_RESOLVE -- DNS lookup */
OPENVPN_STATE_TCP_CONNECT -- Connecting to TCP server
Echo management state change to log.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1068 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | socket.c | 32 |
1 files changed, 26 insertions, 6 deletions
@@ -37,6 +37,7 @@ #include "gremlin.h" #include "plugin.h" #include "ps.h" +#include "manage.h" #include "memdbg.h" @@ -112,6 +113,18 @@ getaddr (unsigned int flags, goto done; } +#ifdef ENABLE_MANAGEMENT + if (flags & GETADDR_UPDATE_MANAGEMENT_STATE) + { + if (management) + management_set_state (management, + OPENVPN_STATE_RESOLVE, + NULL, + (in_addr_t)0, + (in_addr_t)0); + } +#endif + /* * Resolve hostname */ @@ -243,7 +256,7 @@ update_remote (const char* host, if (host && addr) { const in_addr_t new_addr = getaddr ( - GETADDR_RESOLVE, + GETADDR_RESOLVE|GETADDR_UPDATE_MANAGEMENT_STATE, host, 1, NULL, @@ -817,6 +830,15 @@ socket_connect (socket_descriptor_t *sd, { int status; +#ifdef ENABLE_MANAGEMENT + if (management) + management_set_state (management, + OPENVPN_STATE_TCP_CONNECT, + NULL, + (in_addr_t)0, + (in_addr_t)0); +#endif + status = openvpn_connect (*sd, remote, connect_timeout, signal_received); get_signal (signal_received); @@ -962,13 +984,12 @@ resolve_remote (struct link_socket *sock, if (sock->remote_host) { - unsigned int flags = 0; + unsigned int flags = GETADDR_RESOLVE|GETADDR_UPDATE_MANAGEMENT_STATE; int retry = 0; bool status = false; if (remote_list_len (sock->remote_list) > 1 && sock->resolve_retry_seconds == RESOLV_RETRY_INFINITE) { - flags = GETADDR_RESOLVE; if (phase == 2) flags |= (GETADDR_TRY_ONCE | GETADDR_FATAL); retry = 0; @@ -977,12 +998,11 @@ resolve_remote (struct link_socket *sock, { if (sock->resolve_retry_seconds) { - flags = GETADDR_RESOLVE; retry = 0; } else { - flags = GETADDR_RESOLVE | GETADDR_FATAL | GETADDR_MENTION_RESOLVE_RETRY; + flags |= (GETADDR_FATAL | GETADDR_MENTION_RESOLVE_RETRY); retry = 0; } } @@ -990,7 +1010,7 @@ resolve_remote (struct link_socket *sock, { if (sock->resolve_retry_seconds) { - flags = GETADDR_RESOLVE | GETADDR_FATAL; + flags |= GETADDR_FATAL; retry = sock->resolve_retry_seconds; } else |