Drop supports_all_posix_ai_flags

This commit is contained in:
Corinna Vinschen 2015-12-15 14:54:19 +01:00
parent a759558418
commit 6f560555bd
3 changed files with 2 additions and 84 deletions

View File

@ -3499,13 +3499,10 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */
whints.ai_addrlen &= UINT32_MAX;
#endif
/* AI_ADDRCONFIG is not supported prior to Vista. Rather it's
the default and only possible setting.
On Vista, the default behaviour is as if AI_ADDRCONFIG is set,
/* On Windows, the default behaviour is as if AI_ADDRCONFIG is set,
apparently for performance reasons. To get the POSIX default
behaviour, the AI_ALL flag has to be set. */
if (wincap.supports_all_posix_ai_flags ()
&& whints.ai_family == PF_UNSPEC
if (whints.ai_family == PF_UNSPEC
&& !(whints.ai_flags & AI_ADDRCONFIG))
whints.ai_flags |= AI_ALL;
}
@ -3529,51 +3526,6 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
if (!*res)
__leave;
}
/* AI_V4MAPPED and AI_ALL are not supported prior to Vista. So, what
we do here is to emulate AI_V4MAPPED. If no IPv6 addresses are
returned, or the AI_ALL flag is set, we try with AF_INET again, and
convert the returned IPv4 addresses into v4-in-v6 entries. This
is done in ga_dup if the v4mapped flag is set. */
if (!wincap.supports_all_posix_ai_flags ()
&& hints
&& hints->ai_family == AF_INET6
&& (hints->ai_flags & AI_V4MAPPED)
&& (ret == EAI_NODATA || ret == EAI_NONAME
|| (hints->ai_flags & AI_ALL)))
{
/* sizeof addrinfo == sizeof addrinfoW */
memcpy (&whints, hints, sizeof whints);
whints.ai_family = AF_INET;
#ifdef __x86_64__
/* ai_addrlen is socklen_t (4 bytes) in POSIX but size_t (8 bytes) in
Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */
whints.ai_addrlen &= UINT32_MAX;
#endif
int ret2 = w32_to_gai_err (GetAddrInfoW (whost, wserv, &whints, &wres));
if (!ret2)
{
struct addrinfo *v4res = ga_duplist (wres, true, idn_flags, ret);
FreeAddrInfoW (wres);
if (!v4res)
{
if (!ret)
cygwin_freeaddrinfo (*res);
__leave;
}
/* If a list of v6 addresses exists, append the v4-in-v6 address
list. Otherwise just return the v4-in-v6 address list. */
if (!ret)
{
struct addrinfo *ptr;
for (ptr = *res; ptr->ai_next; ptr = ptr->ai_next)
;
ptr->ai_next = v4res;
}
else
*res = v4res;
ret = 0;
}
}
}
__except (EFAULT)
{
@ -3592,31 +3544,6 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen,
__try
{
/* When the incoming port number does not resolve to a well-known service,
WinSock's getnameinfo up to Windows 2003 returns with error WSANO_DATA
instead of setting `serv' to the numeric port number string, as
required by RFC 3493. This is fixed on Vista and later. To avoid the
error on systems up to Windows 2003, we check if the port number
resolves to a well-known service. If not, we set the NI_NUMERICSERV
flag. */
if (!wincap.supports_all_posix_ai_flags ())
{
int port = 0;
switch (sa->sa_family)
{
case AF_INET:
port = ((struct sockaddr_in *) sa)->sin_port;
break;
case AF_INET6:
port = ((struct sockaddr_in6 *) sa)->sin6_port;
break;
default:
return EAI_FAMILY;
}
if (!port || !getservbyport (port, flags & NI_DGRAM ? "udp" : "tcp"))
flags |= NI_NUMERICSERV;
}
/* We call GetNameInfoW with local buffers and convert to locale
charset to allow RFC 3490 IDNs like glibc 2.3.4 and later. */
#define NI_IDN_MASK (NI_IDN | \

View File

@ -24,7 +24,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:false,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:false,
supports_all_posix_ai_flags:false,
has_restricted_stack_args:false,
has_transactions:false,
has_sendmsg:false,
@ -57,7 +56,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:false,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:false,
supports_all_posix_ai_flags:false,
has_restricted_stack_args:true,
has_transactions:false,
has_sendmsg:false,
@ -90,7 +88,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:true,
needs_count_in_si_lpres2:true,
has_gaa_largeaddress_bug:true,
supports_all_posix_ai_flags:true,
has_restricted_stack_args:false,
has_transactions:true,
has_sendmsg:true,
@ -123,7 +120,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:true,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:true,
supports_all_posix_ai_flags:true,
has_restricted_stack_args:false,
has_transactions:true,
has_sendmsg:true,
@ -156,7 +152,6 @@ wincaps wincap_8 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:true,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:false,
supports_all_posix_ai_flags:true,
has_restricted_stack_args:false,
has_transactions:true,
has_sendmsg:true,
@ -189,7 +184,6 @@ wincaps wincap_10 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_mandatory_integrity_control:true,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:false,
supports_all_posix_ai_flags:true,
has_restricted_stack_args:false,
has_transactions:true,
has_sendmsg:true,
@ -222,7 +216,6 @@ wincaps wincap_10_1511 __attribute__((section (".cygwin_dll_common"), shared)) =
has_mandatory_integrity_control:true,
needs_count_in_si_lpres2:false,
has_gaa_largeaddress_bug:false,
supports_all_posix_ai_flags:true,
has_restricted_stack_args:false,
has_transactions:true,
has_sendmsg:true,

View File

@ -17,7 +17,6 @@ struct wincaps
unsigned has_mandatory_integrity_control : 1;
unsigned needs_count_in_si_lpres2 : 1;
unsigned has_gaa_largeaddress_bug : 1;
unsigned supports_all_posix_ai_flags : 1;
unsigned has_restricted_stack_args : 1;
unsigned has_transactions : 1;
unsigned has_sendmsg : 1;
@ -75,7 +74,6 @@ public:
bool IMPLEMENT (has_mandatory_integrity_control)
bool IMPLEMENT (needs_count_in_si_lpres2)
bool IMPLEMENT (has_gaa_largeaddress_bug)
bool IMPLEMENT (supports_all_posix_ai_flags)
bool IMPLEMENT (has_restricted_stack_args)
bool IMPLEMENT (has_transactions)
bool IMPLEMENT (has_sendmsg)