diff options
author | Gert Doering <gert@greenie.muc.de> | 2015-05-31 15:59:09 +0200 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2015-06-02 09:30:37 +0200 |
commit | 288a819af7d3a6fab9e0b69ae8dbaac74b36307b (patch) | |
tree | f1a55dc491d6f732941dbbb1c492a8c8ebc81048 /src | |
parent | 1e2b229e5140b784820906feb8446e47c1ecc62e (diff) | |
download | openvpn-288a819af7d3a6fab9e0b69ae8dbaac74b36307b.tar.gz openvpn-288a819af7d3a6fab9e0b69ae8dbaac74b36307b.tar.xz openvpn-288a819af7d3a6fab9e0b69ae8dbaac74b36307b.zip |
Move res_init() call to inner openvpn_getaddrinfo() loop
A non-working nameserver in /etc/resolv.conf could lead to endless
loops inside openvpn_getaddrinfo(), because many systems will only
pick up changes to resolv.conf if res_init() is called again.
To reproduce, run openvpn with --resolv-retry infinite (2.3) or
--resolv-retry "a high number" (master) on a BSD system. Linux
glibc seems to stat() resolv.conf on calls to getaddrinfo() and
pick up changes automatically.
Trac #523
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1433080749-6892-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9763
Diffstat (limited to 'src')
-rw-r--r-- | src/openvpn/socket.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 4f1139d..7f889b1 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -314,10 +314,6 @@ openvpn_getaddrinfo (unsigned int flags, ASSERT(res); -#ifndef WIN32 - res_init (); -#endif - ASSERT (hostname || servname); ASSERT (!(flags & GETADDR_HOST_ORDER)); @@ -394,6 +390,9 @@ openvpn_getaddrinfo (unsigned int flags, */ while (true) { +#ifndef WIN32 + res_init (); +#endif /* try hostname lookup */ hints.ai_flags &= ~AI_NUMERICHOST; dmsg (D_SOCKET_DEBUG, "GETADDRINFO flags=0x%04x ai_family=%d ai_socktype=%d", |