mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-06 19:19:58 +00:00
GitHub issue #235, and I also see no reason not to communicate with people from other Worlds.
This commit is contained in:
parent
a775ee7d31
commit
2debde3451
@ -347,6 +347,11 @@
|
|||||||
*/
|
*/
|
||||||
#define ZT_MAX_BRIDGE_SPAM 16
|
#define ZT_MAX_BRIDGE_SPAM 16
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum number of endpoints to contact per address type (to limit pushes like GitHub issue #235)
|
||||||
|
*/
|
||||||
|
#define ZT_PUSH_DIRECT_PATHS_MAX_ENDPOINTS_PER_TYPE 8
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A test pseudo-network-ID that can be joined
|
* A test pseudo-network-ID that can be joined
|
||||||
*
|
*
|
||||||
|
@ -296,8 +296,7 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
|||||||
outp.append((uint16_t)ZEROTIER_ONE_VERSION_REVISION);
|
outp.append((uint16_t)ZEROTIER_ONE_VERSION_REVISION);
|
||||||
_remoteAddress.serialize(outp);
|
_remoteAddress.serialize(outp);
|
||||||
|
|
||||||
if ((worldId != ZT_WORLD_ID_NULL)&&(worldId == RR->topology->worldId())) {
|
if ((worldId != ZT_WORLD_ID_NULL)&&(RR->topology->worldTimestamp() > worldTimestamp)&&(worldId == RR->topology->worldId())) {
|
||||||
if (RR->topology->worldTimestamp() > worldTimestamp) {
|
|
||||||
World w(RR->topology->world());
|
World w(RR->topology->world());
|
||||||
const unsigned int sizeAt = outp.size();
|
const unsigned int sizeAt = outp.size();
|
||||||
outp.addSize(2); // make room for 16-bit size field
|
outp.addSize(2); // make room for 16-bit size field
|
||||||
@ -309,9 +308,6 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR)
|
|||||||
|
|
||||||
outp.armor(peer->key(),true);
|
outp.armor(peer->key(),true);
|
||||||
RR->node->putPacket(_localAddress,_remoteAddress,outp.data(),outp.size());
|
RR->node->putPacket(_localAddress,_remoteAddress,outp.data(),outp.size());
|
||||||
} else {
|
|
||||||
TRACE("dropped HELLO from %s(%s): world ID mismatch: peer is %llu and we are %llu",source().toString().c_str(),_remoteAddress.toString().c_str(),worldId,RR->topology->worldId());
|
|
||||||
}
|
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
TRACE("dropped HELLO from %s(%s): unexpected exception",source().toString().c_str(),_remoteAddress.toString().c_str());
|
TRACE("dropped HELLO from %s(%s): unexpected exception",source().toString().c_str(),_remoteAddress.toString().c_str());
|
||||||
}
|
}
|
||||||
@ -867,6 +863,7 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,const Sha
|
|||||||
try {
|
try {
|
||||||
unsigned int count = at<uint16_t>(ZT_PACKET_IDX_PAYLOAD);
|
unsigned int count = at<uint16_t>(ZT_PACKET_IDX_PAYLOAD);
|
||||||
unsigned int ptr = ZT_PACKET_IDX_PAYLOAD + 2;
|
unsigned int ptr = ZT_PACKET_IDX_PAYLOAD + 2;
|
||||||
|
unsigned int v4Count = 0,v6Count = 0;
|
||||||
|
|
||||||
while (count--) { // if ptr overflows Buffer will throw
|
while (count--) { // if ptr overflows Buffer will throw
|
||||||
// TODO: some flags are not yet implemented
|
// TODO: some flags are not yet implemented
|
||||||
@ -882,6 +879,7 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,const Sha
|
|||||||
InetAddress a(field(ptr,4),4,at<uint16_t>(ptr + 4));
|
InetAddress a(field(ptr,4),4,at<uint16_t>(ptr + 4));
|
||||||
if ( ((flags & 0x01) == 0) && (Path::isAddressValidForPath(a)) ) {
|
if ( ((flags & 0x01) == 0) && (Path::isAddressValidForPath(a)) ) {
|
||||||
TRACE("attempting to contact %s at pushed direct path %s",peer->address().toString().c_str(),a.toString().c_str());
|
TRACE("attempting to contact %s at pushed direct path %s",peer->address().toString().c_str(),a.toString().c_str());
|
||||||
|
if (v4Count++ < ZT_PUSH_DIRECT_PATHS_MAX_ENDPOINTS_PER_TYPE)
|
||||||
peer->attemptToContactAt(RR,_localAddress,a,RR->node->now());
|
peer->attemptToContactAt(RR,_localAddress,a,RR->node->now());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
@ -889,6 +887,7 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,const Sha
|
|||||||
InetAddress a(field(ptr,16),16,at<uint16_t>(ptr + 16));
|
InetAddress a(field(ptr,16),16,at<uint16_t>(ptr + 16));
|
||||||
if ( ((flags & 0x01) == 0) && (Path::isAddressValidForPath(a)) ) {
|
if ( ((flags & 0x01) == 0) && (Path::isAddressValidForPath(a)) ) {
|
||||||
TRACE("attempting to contact %s at pushed direct path %s",peer->address().toString().c_str(),a.toString().c_str());
|
TRACE("attempting to contact %s at pushed direct path %s",peer->address().toString().c_str(),a.toString().c_str());
|
||||||
|
if (v6Count++ < ZT_PUSH_DIRECT_PATHS_MAX_ENDPOINTS_PER_TYPE)
|
||||||
peer->attemptToContactAt(RR,_localAddress,a,RR->node->now());
|
peer->attemptToContactAt(RR,_localAddress,a,RR->node->now());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user