diff options
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_resolv_gai.c | 18 | ||||
| -rw-r--r-- | src/platform/windows/win_resolv.c | 5 | ||||
| -rw-r--r-- | src/platform/windows/win_tcp.c | 10 |
3 files changed, 10 insertions, 23 deletions
diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c index 96d8debd..ad1d5147 100644 --- a/src/platform/posix/posix_resolv_gai.c +++ b/src/platform/posix/posix_resolv_gai.c @@ -140,26 +140,16 @@ resolv_task(void *arg) // We treat these all as IP addresses. The service and the // host part are split. memset(&hints, 0, sizeof(hints)); - if (item->passive) { - hints.ai_flags |= AI_PASSIVE; - } + hints.ai_flags = AI_NUMERICSERV; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; #endif + if (item->passive) { + hints.ai_flags |= AI_PASSIVE; + } hints.ai_protocol = item->proto; hints.ai_family = item->family; - // We prefer to have v4mapped addresses if a remote - // v4 address isn't available. And we prefer to only - // do this if we actually support v6. - if (item->family == AF_INET6) { -#if defined(AI_V4MAPPED_CFG) - hints.ai_flags |= AI_V4MAPPED_CFG; -#elif defined(AI_V4MAPPED) - hints.ai_flags |= AI_V4MAPPED; -#endif - } - rv = getaddrinfo(item->name, item->serv, &hints, &results); if (rv != 0) { rv = nni_posix_gai_errno(rv); diff --git a/src/platform/windows/win_resolv.c b/src/platform/windows/win_resolv.c index 2bc68c32..54f1c61c 100644 --- a/src/platform/windows/win_resolv.c +++ b/src/platform/windows/win_resolv.c @@ -127,15 +127,12 @@ win_resolv_task(void *arg) // We treat these all as IP addresses. The service and the // host part are split. memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV; if (item->passive) { hints.ai_flags |= AI_PASSIVE; } - hints.ai_flags |= AI_ADDRCONFIG; hints.ai_protocol = item->proto; hints.ai_family = item->family; - if (item->family == AF_INET6) { - hints.ai_flags |= AI_V4MAPPED; - } rv = getaddrinfo(item->name, item->serv, &hints, &results); if (rv != 0) { diff --git a/src/platform/windows/win_tcp.c b/src/platform/windows/win_tcp.c index 4d7d6027..33c4a1a5 100644 --- a/src/platform/windows/win_tcp.c +++ b/src/platform/windows/win_tcp.c @@ -680,17 +680,17 @@ nni_plat_tcp_ep_connect(nni_plat_tcp_ep *ep, nni_aio *aio) int nni_plat_tcp_ntop(const nni_sockaddr *sa, char *ipstr, char *portstr) { - const void *ap; - uint16_t port; - int af; + void * ap; + uint16_t port; + int af; switch (sa->s_family) { case NNG_AF_INET: - ap = &sa->s_in.sa_addr; + ap = (void *) &sa->s_in.sa_addr; port = sa->s_in.sa_port; af = AF_INET; break; case NNG_AF_INET6: - ap = &sa->s_in6.sa_addr; + ap = (void *) &sa->s_in6.sa_addr; port = sa->s_in6.sa_port; af = AF_INET6; break; |
