summaryrefslogtreecommitdiff
path: root/thirdparty/libwebsockets
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/libwebsockets')
-rw-r--r--thirdparty/libwebsockets/ipv6_fixes.diff32
-rw-r--r--thirdparty/libwebsockets/lws_config.h4
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-unix.c5
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-win.c5
4 files changed, 45 insertions, 1 deletions
diff --git a/thirdparty/libwebsockets/ipv6_fixes.diff b/thirdparty/libwebsockets/ipv6_fixes.diff
new file mode 100644
index 0000000000..fe3e5e4b63
--- /dev/null
+++ b/thirdparty/libwebsockets/ipv6_fixes.diff
@@ -0,0 +1,32 @@
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-unix.c b/thirdparty/libwebsockets/plat/lws-plat-unix.c
+index 7dba3bd82..d1bca8b5d 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-unix.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-unix.c
+@@ -328,6 +328,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
+ int optval = 1;
+ socklen_t optlen = sizeof(optval);
+
++#ifdef LWS_WITH_IPV6
++ optval = 0;
++ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
++#endif
++
+ #if defined(__APPLE__) || \
+ defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || \
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
+index 1850b6425..26caab2cd 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
+@@ -348,6 +348,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
+ struct protoent *tcp_proto;
+ #endif
+
++#ifdef LWS_WITH_IPV6
++ optval = 0;
++ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
++#endif
++
+ if (vhost->ka_time) {
+ /* enable keepalive on this socket */
+ optval = 1;
diff --git a/thirdparty/libwebsockets/lws_config.h b/thirdparty/libwebsockets/lws_config.h
index 6ec3eed139..fdf02157cc 100644
--- a/thirdparty/libwebsockets/lws_config.h
+++ b/thirdparty/libwebsockets/lws_config.h
@@ -77,8 +77,10 @@
/* #undef LWS_WITH_LIBEVENT */
/* Build with support for ipv6 */
-/* #undef LWS_WITH_IPV6 */
+/* Everywhere, except in OpenBSD which does not support dual stacking */
+#if !defined(__OpenBSD__)
#define LWS_WITH_IPV6
+#endif
/* Build with support for UNIX domain socket */
/* #undef LWS_WITH_UNIX_SOCK */
diff --git a/thirdparty/libwebsockets/plat/lws-plat-unix.c b/thirdparty/libwebsockets/plat/lws-plat-unix.c
index 7dba3bd82f..d1bca8b5df 100644
--- a/thirdparty/libwebsockets/plat/lws-plat-unix.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-unix.c
@@ -328,6 +328,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
int optval = 1;
socklen_t optlen = sizeof(optval);
+#ifdef LWS_WITH_IPV6
+ optval = 0;
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
+#endif
+
#if defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
defined(__NetBSD__) || \
diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
index 1850b64250..26caab2cde 100644
--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
@@ -348,6 +348,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, lws_sockfd_type fd)
struct protoent *tcp_proto;
#endif
+#ifdef LWS_WITH_IPV6
+ optval = 0;
+ setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void*)&optval, optlen);
+#endif
+
if (vhost->ka_time) {
/* enable keepalive on this socket */
optval = 1;