aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Networking
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-11-12 13:54:43 +0100
committerShauren <shauren.trinity@gmail.com>2024-11-12 13:54:43 +0100
commitaf4dcc93ed04c4f2219c14821b25cb9efeb7e781 (patch)
tree4fc5ac7ef91398ebf7d0684ab5a97ef392e2a2bc /src/server/shared/Networking
parent280af853374b3cabcc2514d9604deeb39d03908b (diff)
Core/Networking: Support IPv6
Diffstat (limited to 'src/server/shared/Networking')
-rw-r--r--src/server/shared/Networking/AsyncAcceptor.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server/shared/Networking/AsyncAcceptor.h b/src/server/shared/Networking/AsyncAcceptor.h
index 7f1cb34204c..95e25e02166 100644
--- a/src/server/shared/Networking/AsyncAcceptor.h
+++ b/src/server/shared/Networking/AsyncAcceptor.h
@@ -22,6 +22,7 @@
#include "IpAddress.h"
#include "Log.h"
#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/ip/v6_only.hpp>
#include <atomic>
#include <functional>
@@ -88,6 +89,11 @@ public:
}
#endif
+ // v6_only is enabled on some *BSD distributions by default
+ // we want to allow both v4 and v6 connections to the same listener
+ if (_endpoint.protocol() == boost::asio::ip::tcp::v6())
+ _acceptor.set_option(boost::asio::ip::v6_only(false));
+
_acceptor.bind(_endpoint, errorCode);
if (errorCode)
{