summaryrefslogtreecommitdiffstats
path: root/drivers/unix/packet_peer_udp_posix.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-18 17:17:44 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2017-01-23 20:18:23 +0100
commit619e7a2c8ba19d0dc45467e29d9d9aa8b3506ac8 (patch)
tree3df91cac5cb49ed2ef27c6a62da7dd1c23ab7886 /drivers/unix/packet_peer_udp_posix.cpp
parent88a56ba783d36d52a1023759e69f026b1ae255b4 (diff)
downloadredot-engine-619e7a2c8ba19d0dc45467e29d9d9aa8b3506ac8.tar.gz
Bind to IPv4 on OpenBSD when using wildcard
OpenBSD does not support binding on both IPv4 and IPv6 using the same socket
Diffstat (limited to 'drivers/unix/packet_peer_udp_posix.cpp')
-rw-r--r--drivers/unix/packet_peer_udp_posix.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp
index fdd1164fbe..88293fc513 100644
--- a/drivers/unix/packet_peer_udp_posix.cpp
+++ b/drivers/unix/packet_peer_udp_posix.cpp
@@ -129,7 +129,11 @@ Error PacketPeerUDPPosix::listen(int p_port, IP_Address p_bind_address, int p_re
ERR_FAIL_COND_V(sockfd!=-1,ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(),ERR_INVALID_PARAMETER);
+#ifdef __OpenBSD__
+ sock_type = IP::TYPE_IPV4; // OpenBSD does not support dual stacking, fallback to IPv4 only.
+#else
sock_type = IP::TYPE_ANY;
+#endif
if(p_bind_address.is_valid())
sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;