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>
This commit is contained in:
parent
f75114fc59
commit
7176a85cd4
|
@ -3595,7 +3595,16 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
||||||
}
|
}
|
||||||
/* Disable automatic IDN conversion on W8 and later. */
|
/* Disable automatic IDN conversion on W8 and later. */
|
||||||
whints.ai_flags |= AI_DISABLE_IDN_ENCODING;
|
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. */
|
/* Always copy over to self-allocated memory. */
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue