diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-02-25 17:13:38 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-02-25 18:39:56 -0800 |
| commit | 53a9740d1dcbad6be4b4c1a10a5f3fcbb97a5be9 (patch) | |
| tree | 00c49f3cd56f5797ec0d3f31dab689c6573fc6e6 /tests | |
| parent | 8e62028a0db24364ea218007811e58ea11d0b64f (diff) | |
| download | nng-53a9740d1dcbad6be4b4c1a10a5f3fcbb97a5be9.tar.gz nng-53a9740d1dcbad6be4b4c1a10a5f3fcbb97a5be9.tar.bz2 nng-53a9740d1dcbad6be4b4c1a10a5f3fcbb97a5be9.zip | |
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.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/udp.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/udp.c b/tests/udp.c index c2772048..d11123fe 100644 --- a/tests/udp.c +++ b/tests/udp.c @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -57,8 +57,8 @@ TestMain("UDP support", { char rbuf[1024]; nng_sockaddr to; nng_sockaddr from; - nng_aio * aio1; - nng_aio * aio2; + nng_aio *aio1; + nng_aio *aio2; nng_iov iov1; nng_iov iov2; @@ -102,7 +102,7 @@ TestMain("UDP support", { Convey("Sending without an address fails", { nng_aio *aio1; - char * msg = "nope"; + char *msg = "nope"; nng_iov iov; So(nng_aio_alloc(&aio1, NULL, NULL) == 0); @@ -126,10 +126,10 @@ TestMain("UDP support", { nng_sockaddr to2; nng_sockaddr from1; nng_sockaddr from2; - nng_aio * aio1; - nng_aio * aio2; - nng_aio * aio3; - nng_aio * aio4; + nng_aio *aio1; + nng_aio *aio2; + nng_aio *aio3; + nng_aio *aio4; nng_iov iov1; nng_iov iov2; nng_iov iov3; @@ -192,7 +192,7 @@ TestMain("UDP support", { Convey("Sending without an address fails", { nng_aio *aio1; - char * msg = "nope"; + char *msg = "nope"; nng_iov iov; So(nng_aio_alloc(&aio1, NULL, NULL) == 0); @@ -206,9 +206,10 @@ TestMain("UDP support", { nng_aio_free(aio1); }); +#ifdef NNG_ENABLE_IPV6 Convey("Sending to an IPv6 address on IPv4 fails", { - nng_aio * aio1; - char * msg = "nope"; + nng_aio *aio1; + char *msg = "nope"; nng_sockaddr sa; int rv; nng_iov iov; @@ -231,19 +232,17 @@ TestMain("UDP support", { rv == NNG_EUNREACHABLE || rv == NNG_EINVAL); nng_aio_free(aio1); }); +#endif Convey("Sending to an IPC address fails", { - nng_aio * aio1; - char * msg = "nope"; + nng_aio *aio1; + char *msg = "nope"; nng_sockaddr sa; int rv; nng_iov iov; - sa.s_in6.sa_family = NNG_AF_INET6; - // address is for google.com - inet_ntop(AF_INET6, "2607:f8b0:4007:804::200e", - (void *) sa.s_in6.sa_addr, 16); - sa.s_in6.sa_port = 80; + sa.s_ipc.sa_family = NNG_AF_IPC; + strcat(sa.s_ipc.sa_path, "/tmp/junk"); So(nng_aio_alloc(&aio1, NULL, NULL) == 0); iov.iov_buf = msg; iov.iov_len = strlen(msg) + 1; |
