diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-05-15 19:23:05 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-15 19:23:05 -0700 |
| commit | 59ee3628d5db511ce5527ce4ddbf126e929d7da8 (patch) | |
| tree | b50ee899adbc7a1066f8b0ced2316773ee2f064e | |
| parent | f69b4c1da69d1e9c513ad63da488a49b6b46a706 (diff) | |
| download | nng-59ee3628d5db511ce5527ce4ddbf126e929d7da8.tar.gz nng-59ee3628d5db511ce5527ce4ddbf126e929d7da8.tar.bz2 nng-59ee3628d5db511ce5527ce4ddbf126e929d7da8.zip | |
fixes #430 Unable to build in MSYS + Win-builds
fixes #438 Consider dropping AI_V4MAPPED
| -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 | ||||
| -rw-r--r-- | tests/ipcwinsec.c | 5 | ||||
| -rw-r--r-- | tests/resolv.c | 26 |
5 files changed, 13 insertions, 51 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; diff --git a/tests/ipcwinsec.c b/tests/ipcwinsec.c index e6d2a205..1c226c7c 100644 --- a/tests/ipcwinsec.c +++ b/tests/ipcwinsec.c @@ -25,7 +25,6 @@ #ifndef _WIN32 TestMain("IPC Security Descriptor", { - atexit(nng_fini); Convey("Given a socket and an IPC listener", { nng_socket s; @@ -94,7 +93,6 @@ TestMain("IPC Security Descriptor", { So(nng_listener_create(&l, s, "ipc://" ADDR) == 0); Convey("We can set security descriptor on Windows", { - SECURITY_DESCRIPTOR *sdesc; SID users; DWORD size; @@ -136,7 +134,7 @@ TestMain("IPC Security Descriptor", { Reset({ LocalFree(sd); }); So(dacl->AceCount == 1); - So(GetAce(dacl, 0, &ace) == TRUE); + So(GetAce(dacl, 0, (void **) &ace) == TRUE); allowed = (PACCESS_ALLOWED_ACE) ace; asid = (PSID) &allowed->SidStart; So(IsValidSid(asid)); @@ -145,7 +143,6 @@ TestMain("IPC Security Descriptor", { }); Convey("We cannot set security descriptor after started", { - SECURITY_DESCRIPTOR *sdesc; SID users; DWORD size; diff --git a/tests/resolv.c b/tests/resolv.c index dfc599c0..1d502eec 100644 --- a/tests/resolv.c +++ b/tests/resolv.c @@ -147,37 +147,15 @@ TestMain("Resolver", { nng_aio_free(aio); }); - Convey("TCP Name service resolves", { + Convey("Name service names not supported", { nng_aio * aio; - const char * str; nng_sockaddr sa; So(nng_aio_alloc(&aio, NULL, NULL) == 0); nng_aio_set_input(aio, 0, &sa); nni_plat_tcp_resolv("8.8.4.4", "http", NNG_AF_INET, 1, aio); nng_aio_wait(aio); - So(nng_aio_result(aio) == 0); - So(sa.s_in.sa_family == NNG_AF_INET); - So(sa.s_in.sa_port == ntohs(80)); - str = ip4tostr(&sa.s_in.sa_addr); - So(strcmp(str, "8.8.4.4") == 0); - nng_aio_free(aio); - }); - - Convey("UDP Name service resolves", { - nng_aio * aio; - const char * str; - nng_sockaddr sa; - - So(nng_aio_alloc(&aio, NULL, NULL) == 0); - nng_aio_set_input(aio, 0, &sa); - nni_plat_udp_resolv("8.8.4.4", "tftp", NNG_AF_INET, 1, aio); - nng_aio_wait(aio); - So(nng_aio_result(aio) == 0); - So(sa.s_in.sa_family == NNG_AF_INET); - So(sa.s_in.sa_port == ntohs(69)); - str = ip4tostr(&sa.s_in.sa_addr); - So(strcmp(str, "8.8.4.4") == 0); + So(nng_aio_result(aio) == NNG_EADDRINVAL); nng_aio_free(aio); }); |
