mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Merge branch 'adamierymenko-dev' of 10.211.55.2:/Users/api/Code/local-ZeroTierOne into adamierymenko-dev
This commit is contained in:
commit
086050686f
2 changed files with 23 additions and 3 deletions
|
@ -51,7 +51,8 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
|
||||||
if (_step == DECODE_STEP_WAITING_FOR_ORIGINAL_SUBMITTER_LOOKUP) {
|
if (_step == DECODE_STEP_WAITING_FOR_ORIGINAL_SUBMITTER_LOOKUP) {
|
||||||
// This means we've already decoded, decrypted, decompressed, and
|
// This means we've already decoded, decrypted, decompressed, and
|
||||||
// validated, and we're processing a MULTICAST_FRAME. We're waiting
|
// validated, and we're processing a MULTICAST_FRAME. We're waiting
|
||||||
// for a lookup on the frame's original submitter.
|
// for a lookup on the frame's original submitter. So try again and
|
||||||
|
// see if we have it.
|
||||||
return _doMULTICAST_FRAME(_r,peer);
|
return _doMULTICAST_FRAME(_r,peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
|
||||||
} else {
|
} else {
|
||||||
// Unencrypted is tolerated in case we want to run this on
|
// Unencrypted is tolerated in case we want to run this on
|
||||||
// devices where squeezing out cycles matters. HMAC is
|
// devices where squeezing out cycles matters. HMAC is
|
||||||
// what's really important.
|
// what's really important. But log it in debug to catch any
|
||||||
|
// packets being mistakenly sent in the clear.
|
||||||
TRACE("ODD: %s from %s(%s) wasn't encrypted",Packet::verbString(verb()),source().toString().c_str(),_remoteAddress.toString().c_str());
|
TRACE("ODD: %s from %s(%s) wasn't encrypted",Packet::verbString(verb()),source().toString().c_str(),_remoteAddress.toString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +110,7 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
_step = DECODE_STEP_WAITING_FOR_SENDER_LOOKUP;
|
||||||
_r->sw->requestWhois(source());
|
_r->sw->requestWhois(source());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,14 @@ class PacketDecoder : public Packet
|
||||||
friend class SharedPtr<PacketDecoder>;
|
friend class SharedPtr<PacketDecoder>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Create a new packet-in-decode
|
||||||
|
*
|
||||||
|
* @param b Source buffer with raw packet data
|
||||||
|
* @param localPort Local port on which packet was received
|
||||||
|
* @param remoteAddress Address from which packet came
|
||||||
|
* @throws std::out_of_range Range error processing packet
|
||||||
|
*/
|
||||||
template<unsigned int C2>
|
template<unsigned int C2>
|
||||||
PacketDecoder(const Buffer<C2> &b,Demarc::Port localPort,const InetAddress &remoteAddress)
|
PacketDecoder(const Buffer<C2> &b,Demarc::Port localPort,const InetAddress &remoteAddress)
|
||||||
throw(std::out_of_range) :
|
throw(std::out_of_range) :
|
||||||
|
@ -65,8 +73,15 @@ public:
|
||||||
/**
|
/**
|
||||||
* Attempt to decode this packet
|
* Attempt to decode this packet
|
||||||
*
|
*
|
||||||
|
* Note that this returns 'true' if processing is complete. This says nothing
|
||||||
|
* about whether the packet was valid. A rejection is 'complete.'
|
||||||
|
*
|
||||||
|
* Once true is returned, this should not be called again.
|
||||||
|
*
|
||||||
* @param _r Runtime environment
|
* @param _r Runtime environment
|
||||||
* @return True if decoding and processing is complete, false on failure (try again)
|
* @return True if decoding and processing is complete, false if caller should try again
|
||||||
|
* @throws std::out_of_range Range error processing packet (should be discarded)
|
||||||
|
* @throws std::runtime_error Other error processing packet (should be discarded)
|
||||||
*/
|
*/
|
||||||
bool tryDecode(const RuntimeEnvironment *_r)
|
bool tryDecode(const RuntimeEnvironment *_r)
|
||||||
throw(std::out_of_range,std::runtime_error);
|
throw(std::out_of_range,std::runtime_error);
|
||||||
|
@ -97,6 +112,8 @@ private:
|
||||||
const SharedPtr<Peer> &p,
|
const SharedPtr<Peer> &p,
|
||||||
Topology::PeerVerifyResult result);
|
Topology::PeerVerifyResult result);
|
||||||
|
|
||||||
|
// These are called internally to handle packet contents once it has
|
||||||
|
// been authenticated, decrypted, decompressed, and classified.
|
||||||
bool _doERROR(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
|
bool _doERROR(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
|
||||||
bool _doHELLO(const RuntimeEnvironment *_r);
|
bool _doHELLO(const RuntimeEnvironment *_r);
|
||||||
bool _doOK(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
|
bool _doOK(const RuntimeEnvironment *_r,const SharedPtr<Peer> &peer);
|
||||||
|
|
Loading…
Add table
Reference in a new issue