mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Add more specific check in source==self case instead of dumping it.
This commit is contained in:
parent
fc3f4fb988
commit
29ec7bf3a2
3 changed files with 32 additions and 0 deletions
|
@ -862,6 +862,19 @@ bool Cluster::findBetterEndpoint(InetAddress &redirectTo,const Address &peerAddr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Cluster::isClusterPeerFrontplane(const InetAddress &ip) const
|
||||||
|
{
|
||||||
|
Mutex::Lock _l(_memberIds_m);
|
||||||
|
for(std::vector<uint16_t>::const_iterator mid(_memberIds.begin());mid!=_memberIds.end();++mid) {
|
||||||
|
Mutex::Lock _l2(_members[*mid].lock);
|
||||||
|
for(std::vector<InetAddress>::const_iterator i2(_members[*mid].zeroTierPhysicalEndpoints.begin());i2!=_members[*mid].zeroTierPhysicalEndpoints.end();++i2) {
|
||||||
|
if (ip == *i2)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Cluster::status(ZT_ClusterStatus &status) const
|
void Cluster::status(ZT_ClusterStatus &status) const
|
||||||
{
|
{
|
||||||
const uint64_t now = RR->node->now();
|
const uint64_t now = RR->node->now();
|
||||||
|
|
|
@ -358,6 +358,12 @@ public:
|
||||||
*/
|
*/
|
||||||
bool findBetterEndpoint(InetAddress &redirectTo,const Address &peerAddress,const InetAddress &peerPhysicalAddress,bool offload);
|
bool findBetterEndpoint(InetAddress &redirectTo,const Address &peerAddress,const InetAddress &peerPhysicalAddress,bool offload);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ip Address to check
|
||||||
|
* @return True if this is a cluster frontplane address (excluding our addresses)
|
||||||
|
*/
|
||||||
|
bool isClusterPeerFrontplane(const InetAddress &ip) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill out ZT_ClusterStatus structure (from core API)
|
* Fill out ZT_ClusterStatus structure (from core API)
|
||||||
*
|
*
|
||||||
|
|
|
@ -199,6 +199,14 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
|
|
||||||
//TRACE("<< %.16llx %s -> %s (size: %u)",(unsigned long long)packet->packetId(),source.toString().c_str(),destination.toString().c_str(),packet->size());
|
//TRACE("<< %.16llx %s -> %s (size: %u)",(unsigned long long)packet->packetId(),source.toString().c_str(),destination.toString().c_str(),packet->size());
|
||||||
|
|
||||||
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
if ( (source == RR->identity.address()) && ((!RR->cluster)||(!RR->cluster->isClusterPeerFrontplane(fromAddr))) )
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
if (source == RR->identity.address())
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (destination != RR->identity.address()) {
|
if (destination != RR->identity.address()) {
|
||||||
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) )
|
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) )
|
||||||
return;
|
return;
|
||||||
|
@ -206,7 +214,12 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
Packet packet(data,len);
|
Packet packet(data,len);
|
||||||
|
|
||||||
if (packet.hops() < ZT_RELAY_MAX_HOPS) {
|
if (packet.hops() < ZT_RELAY_MAX_HOPS) {
|
||||||
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
if (source != RR->identity.address())
|
||||||
|
packet.incrementHops();
|
||||||
|
#else
|
||||||
packet.incrementHops();
|
packet.incrementHops();
|
||||||
|
#endif
|
||||||
|
|
||||||
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
||||||
if ((relayTo)&&((relayTo->sendDirect(packet.data(),packet.size(),now,false)))) {
|
if ((relayTo)&&((relayTo->sendDirect(packet.data(),packet.size(),now,false)))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue