From db82903bb06af34a8958fabb33bfd7fea41bf5b1 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 19 Sep 2025 16:04:32 -0400 Subject: [PATCH] don't set IPV6_V6ONLY option for ipv6 socket for Haiku --- libi2pd/NTCP2.cpp | 8 ++++++-- libi2pd/SSU2.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index bc18f5a6..90b478af 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -1536,11 +1536,15 @@ namespace transport } else if (address->IsV6() && (context.SupportsV6 () || context.SupportsMesh ())) { +#if defined(__HAIKU__) + LogPrint (eLogInfo, "NTCP2: Can't listen v6 TCP port ", address->port, ". IPV6_V6ONLY is not supported"); + continue; // IPV6_V6ONLY is not supported. Don't listen ipv6 +#endif m_NTCP2V6Acceptor.reset (new boost::asio::ip::tcp::acceptor (GetService ())); try { - m_NTCP2V6Acceptor->open (boost::asio::ip::tcp::v6()); - m_NTCP2V6Acceptor->set_option (boost::asio::ip::v6_only (true)); + m_NTCP2V6Acceptor->open (boost::asio::ip::tcp::v6()); + m_NTCP2V6Acceptor->set_option (boost::asio::ip::v6_only (true)); m_NTCP2V6Acceptor->set_option (boost::asio::socket_base::reuse_address (true)); #if defined(__linux__) && !defined(_NETINET_IN_H) if (!m_Address6 && !m_YggdrasilAddress) // only if not binded to address diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index 4540b4d2..27e18210 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -289,7 +289,14 @@ namespace transport socket.close (); socket.open (localEndpoint.protocol ()); if (localEndpoint.address ().is_v6 ()) +#if !defined(__HAIKU__) socket.set_option (boost::asio::ip::v6_only (true)); +#else + { + LogPrint (eLogWarning, "SSU2: Socket option IPV6_V6ONLY is not supported"); + m_IsForcedFirewalled6 = true; // IPV6_V6ONLY is not supported, always Firewalled for ipv6 + } +#endif uint64_t bufferSize = i2p::context.GetBandwidthLimit() * 1024 / 5; // max lag = 200ms bufferSize = std::max(SSU2_SOCKET_MIN_BUFFER_SIZE, std::min(bufferSize, SSU2_SOCKET_MAX_BUFFER_SIZE));