aboutsummaryrefslogtreecommitdiff
path: root/drivers/unix/tcp_server_posix.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli2016-10-28 23:11:53 +0200
committerFabio Alessandrelli2016-12-11 18:12:46 +0100
commit754e9aa60a8892cdd6c1d74a822f049f1c71d831 (patch)
treeca3150ea446c3a5fc15a5be6b6feede00ec4c757 /drivers/unix/tcp_server_posix.cpp
parenta2048efd724893569bb2fbf7c53edd96eab6a646 (diff)
downloadgodot-754e9aa60a8892cdd6c1d74a822f049f1c71d831.tar.gz
godot-754e9aa60a8892cdd6c1d74a822f049f1c71d831.tar.zst
godot-754e9aa60a8892cdd6c1d74a822f049f1c71d831.zip
Diffstat (limited to 'drivers/unix/tcp_server_posix.cpp')
-rw-r--r--drivers/unix/tcp_server_posix.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp
index 32fda618b..7028c1a10 100644
--- a/drivers/unix/tcp_server_posix.cpp
+++ b/drivers/unix/tcp_server_posix.cpp
@@ -74,6 +74,14 @@ Error TCPServerPosix::listen(uint16_t p_port, IP_Address::AddrType p_type, const
sockfd = _socket_create(p_type, SOCK_STREAM, IPPROTO_TCP);
ERR_FAIL_COND_V(sockfd == -1, FAILED);
+
+ if(p_type == IP_Address::TYPE_IPV6) {
+ // Use IPv6 only socket
+ int yes = 1;
+ if(setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&yes, sizeof(yes)) != 0) {
+ WARN_PRINT("Unable to unset IPv4 address mapping over IPv6");
+ }
+ }
#ifndef NO_FCNTL
fcntl(sockfd, F_SETFL, O_NONBLOCK);
#else