mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-29 15:43:52 +00:00
Defer NETWORK_CONFIG_REQUEST packets and allow multithreaded processing.
This commit is contained in:
parent
b9e86103cf
commit
45f315e603
@ -61,13 +61,16 @@ bool IncomingPacket::tryDecode(const RuntimeEnvironment *RR,bool deferred)
|
|||||||
|
|
||||||
SharedPtr<Peer> peer(RR->topology->getPeer(sourceAddress));
|
SharedPtr<Peer> peer(RR->topology->getPeer(sourceAddress));
|
||||||
if (peer) {
|
if (peer) {
|
||||||
if (!dearmor(peer->key())) {
|
if (!_authenticated) {
|
||||||
TRACE("dropped packet from %s(%s), MAC authentication failed (size: %u)",peer->address().toString().c_str(),_remoteAddress.toString().c_str(),size());
|
if (!dearmor(peer->key())) {
|
||||||
return true;
|
TRACE("dropped packet from %s(%s), MAC authentication failed (size: %u)",peer->address().toString().c_str(),_remoteAddress.toString().c_str(),size());
|
||||||
}
|
return true;
|
||||||
if (!uncompress()) {
|
}
|
||||||
TRACE("dropped packet from %s(%s), compressed data invalid",peer->address().toString().c_str(),_remoteAddress.toString().c_str());
|
if (!uncompress()) {
|
||||||
return true;
|
TRACE("dropped packet from %s(%s), compressed data invalid",peer->address().toString().c_str(),_remoteAddress.toString().c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_authenticated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Packet::Verb v = verb();
|
const Packet::Verb v = verb();
|
||||||
@ -88,7 +91,13 @@ bool IncomingPacket::tryDecode(const RuntimeEnvironment *RR,bool deferred)
|
|||||||
case Packet::VERB_ECHO: return _doECHO(RR,peer);
|
case Packet::VERB_ECHO: return _doECHO(RR,peer);
|
||||||
case Packet::VERB_MULTICAST_LIKE: return _doMULTICAST_LIKE(RR,peer);
|
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_MEMBERSHIP_CERTIFICATE: return _doNETWORK_MEMBERSHIP_CERTIFICATE(RR,peer);
|
||||||
case Packet::VERB_NETWORK_CONFIG_REQUEST: return _doNETWORK_CONFIG_REQUEST(RR,peer);
|
case Packet::VERB_NETWORK_CONFIG_REQUEST:
|
||||||
|
if ((RR->dpEnabled > 0)&&(!deferred)) {
|
||||||
|
RR->dp->enqueue(this);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return _doNETWORK_CONFIG_REQUEST(RR,peer);
|
||||||
|
}
|
||||||
case Packet::VERB_NETWORK_CONFIG_REFRESH: return _doNETWORK_CONFIG_REFRESH(RR,peer);
|
case Packet::VERB_NETWORK_CONFIG_REFRESH: return _doNETWORK_CONFIG_REFRESH(RR,peer);
|
||||||
case Packet::VERB_MULTICAST_GATHER: return _doMULTICAST_GATHER(RR,peer);
|
case Packet::VERB_MULTICAST_GATHER: return _doMULTICAST_GATHER(RR,peer);
|
||||||
case Packet::VERB_MULTICAST_FRAME: return _doMULTICAST_FRAME(RR,peer);
|
case Packet::VERB_MULTICAST_FRAME: return _doMULTICAST_FRAME(RR,peer);
|
||||||
|
@ -58,7 +58,8 @@ public:
|
|||||||
Packet(),
|
Packet(),
|
||||||
_receiveTime(0),
|
_receiveTime(0),
|
||||||
_localAddress(),
|
_localAddress(),
|
||||||
_remoteAddress()
|
_remoteAddress(),
|
||||||
|
_authenticated(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,10 +80,11 @@ public:
|
|||||||
* @throws std::out_of_range Range error processing packet
|
* @throws std::out_of_range Range error processing packet
|
||||||
*/
|
*/
|
||||||
IncomingPacket(const void *data,unsigned int len,const InetAddress &localAddress,const InetAddress &remoteAddress,uint64_t now) :
|
IncomingPacket(const void *data,unsigned int len,const InetAddress &localAddress,const InetAddress &remoteAddress,uint64_t now) :
|
||||||
Packet(data,len),
|
Packet(data,len),
|
||||||
_receiveTime(now),
|
_receiveTime(now),
|
||||||
_localAddress(localAddress),
|
_localAddress(localAddress),
|
||||||
_remoteAddress(remoteAddress)
|
_remoteAddress(remoteAddress),
|
||||||
|
_authenticated(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +190,7 @@ private:
|
|||||||
uint64_t _receiveTime;
|
uint64_t _receiveTime;
|
||||||
InetAddress _localAddress;
|
InetAddress _localAddress;
|
||||||
InetAddress _remoteAddress;
|
InetAddress _remoteAddress;
|
||||||
|
bool _authenticated;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ZeroTier
|
} // namespace ZeroTier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user