summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-03-06 06:29:19 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-03-06 06:29:46 +0100
commite3ddf1269368db5f476e0980e9b5127c7034d9fd (patch)
treecea43de83e77b2dc9893018df30667cbb0c7647b
parent90210c48627692d281554d6185b5db17a86c852a (diff)
Add fix to libwebsocket to disable V6ONLY.
This was enabled by default on some systems (e.g. Windows).
-rw-r--r--thirdparty/README.md2
-rw-r--r--thirdparty/libwebsockets/ipv6_fixes.diff32
-rw-r--r--thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c5
-rw-r--r--thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c5
4 files changed, 44 insertions, 0 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index f57e1c89c7..4fb4786d67 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -272,6 +272,8 @@ File extracted from upstream source:
- Also copy `win32helpers/` from `win32port/` inside `thirdparty/libwebsockets`
- A fix has been added to allow building for 32-bits UWP, replacing `GetFileSize[Ex]` and `CreateFileW` with supported functions.
There is a diff for this change in `thirdparty/libwebsockets/uwp_fixes.diff`
+- A fix to disable V6ONLY flag from IPv6 sockets (on by default on some systems) has been also applied.
+ The diff for this change can be found in `thirdparty/libwebsockets/ipv6_fixes.diff`
Important: `lws_config.h` and `lws_config_private.h` contains custom
Godot build configurations, check them out when updating.
diff --git a/thirdparty/libwebsockets/ipv6_fixes.diff b/thirdparty/libwebsockets/ipv6_fixes.diff
new file mode 100644
index 0000000000..5fa1e5c520
--- /dev/null
+++ b/thirdparty/libwebsockets/ipv6_fixes.diff
@@ -0,0 +1,32 @@
+diff --git a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
+index 693efd28e..192dddee6 100644
+--- a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
++++ b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
+@@ -73,6 +73,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt)
+ 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/lib/plat/windows/windows-sockets.c b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
+index bf0935057..62a0a4984 100644
+--- a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
++++ b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
+@@ -56,6 +56,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/lib/plat/unix/unix-sockets.c b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
index 693efd28e6..192dddee63 100644
--- a/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
+++ b/thirdparty/libwebsockets/lib/plat/unix/unix-sockets.c
@@ -73,6 +73,11 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt)
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/lib/plat/windows/windows-sockets.c b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
index bf0935057a..62a0a49846 100644
--- a/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
+++ b/thirdparty/libwebsockets/lib/plat/windows/windows-sockets.c
@@ -56,6 +56,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;