mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-09 12:11:15 +00:00
Add ZT_SUPPORT_LEGACY_MULTICAST ifdef to enable the legacy code to all be toggled.
This commit is contained in:
parent
6888c6482c
commit
15d3e383e6
@ -79,7 +79,9 @@ bool IncomingPacket::tryDecode(const RuntimeEnvironment *RR)
|
||||
case Packet::VERB_RENDEZVOUS: return _doRENDEZVOUS(RR,peer);
|
||||
case Packet::VERB_FRAME: return _doFRAME(RR,peer);
|
||||
case Packet::VERB_EXT_FRAME: return _doEXT_FRAME(RR,peer);
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
case Packet::VERB_P5_MULTICAST_FRAME: return _doP5_MULTICAST_FRAME(RR,peer);
|
||||
#endif
|
||||
case Packet::VERB_MULTICAST_LIKE: return _doMULTICAST_LIKE(RR,peer);
|
||||
case Packet::VERB_NETWORK_MEMBERSHIP_CERTIFICATE: return _doNETWORK_MEMBERSHIP_CERTIFICATE(RR,peer);
|
||||
case Packet::VERB_NETWORK_CONFIG_REQUEST: return _doNETWORK_CONFIG_REQUEST(RR,peer);
|
||||
@ -534,6 +536,7 @@ bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,const SharedPtr<P
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
bool IncomingPacket::_doP5_MULTICAST_FRAME(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer)
|
||||
{
|
||||
/* This code is a bit of a hack to handle compatibility with <1.0.0 peers
|
||||
@ -647,6 +650,7 @@ bool IncomingPacket::_doP5_MULTICAST_FRAME(const RuntimeEnvironment *RR,const Sh
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IncomingPacket::_doMULTICAST_LIKE(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer)
|
||||
{
|
||||
|
@ -119,7 +119,9 @@ private:
|
||||
bool _doRENDEZVOUS(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
bool _doFRAME(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
bool _doEXT_FRAME(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
bool _doP5_MULTICAST_FRAME(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
#endif
|
||||
bool _doMULTICAST_LIKE(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
bool _doNETWORK_MEMBERSHIP_CERTIFICATE(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
bool _doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer);
|
||||
|
@ -202,11 +202,13 @@ void Multicaster::send(
|
||||
unsigned int count = 0;
|
||||
|
||||
for(std::vector<Address>::const_iterator ast(alwaysSendTo.begin());ast!=alwaysSendTo.end();++ast) {
|
||||
{ // TODO / LEGACY: don't send new multicast frame to old peers (if we know their version)
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
{
|
||||
SharedPtr<Peer> p(RR->topology->getPeer(*ast));
|
||||
if ((p)&&(p->remoteVersionKnown())&&(p->remoteVersionMajor() < 1))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
out.sendOnly(RR,*ast);
|
||||
if (++count >= limit)
|
||||
@ -217,11 +219,13 @@ void Multicaster::send(
|
||||
while (count < limit) { // limit <= gs.members.size() so idx will never overflow here
|
||||
const MulticastGroupMember &m = gs.members[indexes[idx++]];
|
||||
|
||||
{ // TODO / LEGACY: don't send new multicast frame to old peers (if we know their version)
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
{
|
||||
SharedPtr<Peer> p(RR->topology->getPeer(m.address));
|
||||
if ((p)&&(p->remoteVersionKnown())&&(p->remoteVersionMajor() < 1))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (std::find(alwaysSendTo.begin(),alwaysSendTo.end(),m.address) == alwaysSendTo.end()) {
|
||||
out.sendOnly(RR,m.address);
|
||||
@ -268,11 +272,13 @@ void Multicaster::send(
|
||||
unsigned int count = 0;
|
||||
|
||||
for(std::vector<Address>::const_iterator ast(alwaysSendTo.begin());ast!=alwaysSendTo.end();++ast) {
|
||||
{ // TODO / LEGACY: don't send new multicast frame to old peers (if we know their version)
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
{
|
||||
SharedPtr<Peer> p(RR->topology->getPeer(*ast));
|
||||
if ((p)&&(p->remoteVersionKnown())&&(p->remoteVersionMajor() < 1))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
out.sendAndLog(RR,*ast);
|
||||
if (++count >= limit)
|
||||
@ -283,11 +289,13 @@ void Multicaster::send(
|
||||
while ((count < limit)&&(idx < gs.members.size())) {
|
||||
const MulticastGroupMember &m = gs.members[indexes[idx++]];
|
||||
|
||||
{ // TODO / LEGACY: don't send new multicast frame to old peers (if we know their version)
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
{
|
||||
SharedPtr<Peer> p(RR->topology->getPeer(m.address));
|
||||
if ((p)&&(p->remoteVersionKnown())&&(p->remoteVersionMajor() < 1))
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (std::find(alwaysSendTo.begin(),alwaysSendTo.end(),m.address) == alwaysSendTo.end()) {
|
||||
out.sendAndLog(RR,m.address);
|
||||
@ -299,11 +307,7 @@ void Multicaster::send(
|
||||
if (indexes != idxbuf)
|
||||
delete [] indexes;
|
||||
|
||||
// DEPRECATED / LEGACY / TODO:
|
||||
// Currently we also always send a legacy P5_MULTICAST_FRAME packet to our
|
||||
// supernode. Our supernode then takes care of relaying it down to <1.0.0
|
||||
// nodes. This code can go away (along with support for P5_MULTICAST_FRAME)
|
||||
// once there are no more such nodes on the network.
|
||||
#ifdef ZT_SUPPORT_LEGACY_MULTICAST
|
||||
{
|
||||
SharedPtr<Peer> sn(RR->topology->getBestSupernode());
|
||||
if (sn) {
|
||||
@ -342,6 +346,7 @@ void Multicaster::send(
|
||||
sn->send(RR,outp.data(),outp.size(),now);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Multicaster::clean(uint64_t now)
|
||||
|
Loading…
x
Reference in New Issue
Block a user