diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index dbdd758b..58565fa9 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -212,10 +212,10 @@ namespace data if (!ecode) { #if BOOST_VERSION >= 104900 - if (!hostaddr.is_unspecified () && !i2p::util::net::IsInReservedRange(hostaddr)) // check if address is valid + if (!hostaddr.is_unspecified () && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr))) #else hostaddr.to_string (ecode); - if (!ecode && !i2p::util::net::IsInReservedRange(hostaddr)) + if (!ecode && ((i2p::context.GetNetID () != I2PD_NET_ID) || !i2p::util::net::IsInReservedRange(hostaddr))) #endif { address->host = hostaddr; diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp index 6f32f565..ca7c3103 100644 --- a/libi2pd/Transports.cpp +++ b/libi2pd/Transports.cpp @@ -406,7 +406,7 @@ namespace transport { peer.numAttempts++; auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only - if (address && m_NTCP2Server && !i2p::util::net::IsInReservedRange(address->host)) + if (address && m_NTCP2Server) { // we support NTCP2, it has priority over NTCP and remote address is not in reserved range auto s = std::make_shared (*m_NTCP2Server, peer.router); m_NTCP2Server->Connect (address->host, address->port, s); @@ -417,7 +417,7 @@ namespace transport { peer.numAttempts++; auto address = peer.router->GetNTCPAddress (!context.SupportsV6 ()); - if (address && m_NTCPServer && !i2p::util::net::IsInReservedRange(address->host)) + if (address && m_NTCPServer) { if (!peer.router->UsesIntroducer () && !peer.router->IsUnreachable ()) { @@ -451,7 +451,7 @@ namespace transport { peer.numAttempts++; auto address = peer.router->GetSSUAddress (!context.SupportsV6 ()); - if (address && m_SSUServer && !i2p::util::net::IsInReservedRange(address->host)) + if (address && m_SSUServer) { m_SSUServer->CreateSession (peer.router, address->host, address->port); return true; diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index dcc0f1ca..4f781494 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -3,9 +3,7 @@ #include #include "util.h" -#include "Config.h" #include "Log.h" -#include "version.h" #ifdef WIN32 #include @@ -346,11 +344,6 @@ namespace net } bool IsInReservedRange(const boost::asio::ip::address& host) { - // ignore checking for netid other than main network - int NetID; i2p::config::GetOption("netid", NetID); - if (NetID != I2PD_NET_ID) - return false; - // https://en.wikipedia.org/wiki/Reserved_IP_addresses if(host.is_v4()) {