summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-03-14 17:57:22 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-03-14 17:57:22 +0100
commit7176a85cd48d37bc068312ffa79f254305cf4511 (patch)
tree373233a31a25043d22d6b2d89adeb531fc826720
parentf75114fc597e05b2d3d14df4c264657e4de58221 (diff)
downloadcygnal-7176a85cd48d37bc068312ffa79f254305cf4511.tar.gz
cygnal-7176a85cd48d37bc068312ffa79f254305cf4511.tar.bz2
cygnal-7176a85cd48d37bc068312ffa79f254305cf4511.zip
cygwin_getaddrinfo: workaround Winsock getaddrinfo issue with broken DNS
Add experimental code to workaround the issue described in the thread starting at https://cygwin.com/ml/cygwin/2015-07/msg00350.html There's a hint in https://communities.vmware.com/message/2577858#2577858 that this problem is related to using the AI_ALL flag. This patch checks if GetAddrInfoW returned with WSANO_RECOVERY and if the AI_ALL flag was set, it retries GetAddrInfo without the AI_ALL flag. * net.cc (cygwin_getaddrinfo): Add experimental code to retry GetAddrInfoW without AI_ALL flag if it returned with WSANO_RECOVERY. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/net.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index f046a3b79..31bc11dc0 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -3595,7 +3595,16 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
}
/* Disable automatic IDN conversion on W8 and later. */
whints.ai_flags |= AI_DISABLE_IDN_ENCODING;
- ret = w32_to_gai_err (GetAddrInfoW (whost, wserv, &whints, &wres));
+ ret = GetAddrInfoW (whost, wserv, &whints, &wres);
+ /* Try to workaround an apparent shortcoming in Winsock's getaddrinfo
+ implementation. See this link for details:
+ https://communities.vmware.com/message/2577858#2577858 */
+ if (ret == WSANO_RECOVERY && (whints.ai_flags & AI_ALL))
+ {
+ whints.ai_flags &= ~AI_ALL;
+ ret = GetAddrInfoW (whost, wserv, &whints, &wres);
+ }
+ ret = w32_to_gai_err (ret);
/* Always copy over to self-allocated memory. */
if (!ret)
{