diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 8cdbc9bd..89d24b79 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -1155,7 +1155,7 @@ namespace data router->IsReachableFrom (*compatibleWith)) && !router->IsNAT2NATOnly (*compatibleWith) && router->GetVersion () >= NETDB_MIN_ALLOWED_VERSION && router->IsECIES () && !router->IsHighCongestion (clientTunnel) && - (!i2p::transport::transports.IsCheckReserved () || !router->IsSameSubnet (*compatibleWith)) && + (!i2p::transport::transports.IsCheckReserved () || (!router->IsSameFamily (*compatibleWith) && !router->IsSameSubnet (*compatibleWith))) && (!checkIsReal || router->GetProfile ()->IsReal ()) && (!endpoint || (router->IsV4 () && (!reverse || router->IsPublished (true)))); // endpoint must be ipv4 and published if inbound(reverse) }); @@ -1195,7 +1195,7 @@ namespace data (router->GetCaps () & RouterInfo::eHighBandwidth) && router->GetVersion () >= NETDB_MIN_HIGHBANDWIDTH_VERSION && router->IsECIES () && !router->IsHighCongestion (true) && - (!i2p::transport::transports.IsCheckReserved () || !router->IsSameSubnet (*compatibleWith)) && + (!i2p::transport::transports.IsCheckReserved () || (!router->IsSameFamily (*compatibleWith) && !router->IsSameSubnet (*compatibleWith))) && (!checkIsReal || router->GetProfile ()->IsReal ()) && (!endpoint || (router->IsV4 () && (!reverse || router->IsPublished (true)))); // endpoint must be ipv4 and published if inbound(reverse) diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index 23070fda..f3c9aea3 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -511,11 +511,6 @@ namespace data return true; } - bool RouterInfo::IsFamily (FamilyID famid) const - { - return m_FamilyID == famid; - } - void RouterInfo::ExtractCaps (std::string_view value) { for (auto cap: value) diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index bb3300a8..be9cbcce 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -322,7 +322,8 @@ namespace data bool IsNewer (const uint8_t * buf, size_t len) const; /** return true if we are in a router family and the signature is valid */ - bool IsFamily (FamilyID famid) const; + bool IsFamily (FamilyID famid) const { return m_FamilyID && m_FamilyID == famid; }; + bool IsSameFamily (const RouterInfo& other) const { return IsFamily (other.m_FamilyID); }; // implements RoutingDestination std::shared_ptr GetIdentity () const { return m_RouterIdentity; };