0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

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
This commit is contained in:
Gert Doering 2015-05-31 15:59:09 +02:00
parent 1e2b229e51
commit 288a819af7

View File

@ -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",