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/core/stream.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/core/stream.c') diff --git a/src/core/stream.c b/src/core/stream.c index 99002fcd..95bc4123 100644 --- a/src/core/stream.c +++ b/src/core/stream.c @@ -1,5 +1,5 @@ // -// Copyright 2023 Staysail Systems, Inc. +// Copyright 2024 Staysail Systems, Inc. // // This software is supplied under the terms of the MIT License, a // copy of which should be located in the distribution where this @@ -22,8 +22,8 @@ static struct { const char *scheme; - int (*dialer_alloc)(nng_stream_dialer **, const nng_url *); - int (*listener_alloc)(nng_stream_listener **, const nng_url *); + int (*dialer_alloc)(nng_stream_dialer **, const nng_url *); + int (*listener_alloc)(nng_stream_listener **, const nng_url *); } stream_drivers[] = { { @@ -55,11 +55,13 @@ static struct { .dialer_alloc = nni_tcp_dialer_alloc, .listener_alloc = nni_tcp_listener_alloc, }, +#ifdef NNG_ENABLE_IPV6 { .scheme = "tcp6", .dialer_alloc = nni_tcp_dialer_alloc, .listener_alloc = nni_tcp_listener_alloc, }, +#endif { .scheme = "tls+tcp", .dialer_alloc = nni_tls_dialer_alloc, @@ -70,11 +72,13 @@ static struct { .dialer_alloc = nni_tls_dialer_alloc, .listener_alloc = nni_tls_listener_alloc, }, +#ifdef NNG_ENABLE_IPV6 { .scheme = "tls+tcp6", .dialer_alloc = nni_tls_dialer_alloc, .listener_alloc = nni_tls_listener_alloc, }, +#endif { .scheme = "ws", .dialer_alloc = nni_ws_dialer_alloc, @@ -85,11 +89,13 @@ static struct { .dialer_alloc = nni_ws_dialer_alloc, .listener_alloc = nni_ws_listener_alloc, }, +#ifdef NNG_ENABLE_IPV6 { .scheme = "ws6", .dialer_alloc = nni_ws_dialer_alloc, .listener_alloc = nni_ws_listener_alloc, }, +#endif { .scheme = "wss", .dialer_alloc = nni_ws_dialer_alloc, -- cgit v1.2.3-70-g09d2