From 53a9740d1dcbad6be4b4c1a10a5f3fcbb97a5be9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 25 Feb 2024 17:13:38 -0800 Subject: fixes #1496 Provide NNG_ENABLE_IPV6 option (disabled by default) This also checks if the build system has the definitions for AF_INET6, which might help in some embedded IPv4 only settings. The resolver test is enhanced to include a check for IPv6 enabled in the kernel. IPv6 support is enabled by default, of course. --- src/platform/windows/win_tcpdial.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/platform/windows/win_tcpdial.c') diff --git a/src/platform/windows/win_tcpdial.c b/src/platform/windows/win_tcpdial.c index 9463c241..b4a6d745 100644 --- a/src/platform/windows/win_tcpdial.c +++ b/src/platform/windows/win_tcpdial.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // Copyright 2018 Devolutions // @@ -113,7 +113,7 @@ static void tcp_dial_cancel(nni_aio *aio, void *arg, int rv) { nni_tcp_dialer *d = arg; - nni_tcp_conn * c; + nni_tcp_conn *c; nni_mtx_lock(&d->mtx); if ((c = nni_aio_get_prov_data(aio)) != NULL) { @@ -128,9 +128,9 @@ tcp_dial_cancel(nni_aio *aio, void *arg, int rv) static void tcp_dial_cb(nni_win_io *io, int rv, size_t cnt) { - nni_tcp_conn * c = io->ptr; + nni_tcp_conn *c = io->ptr; nni_tcp_dialer *d = c->dialer; - nni_aio * aio = c->conn_aio; + nni_aio *aio = c->conn_aio; BOOL ka; BOOL nd; @@ -183,7 +183,7 @@ nni_tcp_dial(nni_tcp_dialer *d, const nni_sockaddr *sa, nni_aio *aio) SOCKET s; SOCKADDR_STORAGE ss; int len; - nni_tcp_conn * c; + nni_tcp_conn *c; int rv; if (nni_aio_begin(aio) != 0) { @@ -335,13 +335,15 @@ tcp_dialer_get_locaddr(void *arg, void *buf, size_t *szp, nni_type t) static int tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t) { - nni_tcp_dialer * d = arg; - nng_sockaddr sa; - SOCKADDR_STORAGE ss; - struct sockaddr_in * sin; + nni_tcp_dialer *d = arg; + nng_sockaddr sa; + SOCKADDR_STORAGE ss; + struct sockaddr_in *sin; + size_t sslen; + int rv; +#ifdef NNG_ENABLE_IPV6 struct sockaddr_in6 *sin6; - size_t sslen; - int rv; +#endif if ((rv = nni_copyin_sockaddr(&sa, buf, sz, t)) != 0) { return (rv); @@ -358,12 +360,14 @@ tcp_dialer_set_locaddr(void *arg, const void *buf, size_t sz, nni_type t) return (NNG_EADDRINVAL); } break; +#ifdef NNG_ENABLE_IPV6 case AF_INET6: sin6 = (void *) &ss; if (sin6->sin6_port != 0) { return (NNG_EADDRINVAL); } break; +#endif default: return (NNG_EADDRINVAL); } -- cgit v1.2.3-70-g09d2