Move res_init() call to inner openvpn_getaddrinfo() loop
PATCH 1/1 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
--- src/openvpn/socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
src/openvpn/socket.c +3 -4
@@ -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",
Signature · 1 line
2.4.0
Am 31.05.15 um 15:59 schrieb Gert Doering:
Quoted 9 lines
A non-working nameserver in
/etc/resolv.confcould lead to endless loops insideopenvpn_getaddrinfo(), because many systems will only pick up changes to resolv.conf ifres_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 togetaddrinfo()and pick up changes automatically.
And Android makes even weirder stuff. But if we want to reread the resolv.conf on every call this the right way, so ACK.
Arne
Patch has been applied to the master and release/2.3 branch.
commit 288a819af7d3a6fab9e0b69ae8dbaac74b36307b (master) commit 4e7eb95e43f0daed79e25e0ad6a9a20705b57376 (release/2.3)
Author: Gert Doering Date: Sun May 31 15:59:09 2015 +0200
Move res_init() call to inner openvpn_getaddrinfo() loop
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9763--
kind regards,
Gert Doering