Simply network auth logic and always sent error on auth failure even for unknown networks to prevent forensics.

This commit is contained in:
Adam Ierymenko 2016-09-27 13:49:43 -07:00
parent 5ba7ca91c0
commit 9f550292fe
7 changed files with 64 additions and 61 deletions

View file

@ -267,17 +267,19 @@ public:
}
/**
* Check whether a given packet ID is something we are expecting a reply to
* Check whether a given packet ID is something we are expecting a reply to (and erase from list)
*
* @param packetId Packet ID to check
* @return True if we're expecting a reply
*/
inline bool expectingReplyTo(const uint64_t packetId) const
inline bool expectingReplyTo(const uint64_t packetId)
{
const unsigned long bucket = (unsigned long)(packetId & ZT_EXPECTING_REPLIES_BUCKET_MASK1);
for(unsigned long i=0;i<=ZT_EXPECTING_REPLIES_BUCKET_MASK2;++i) {
if (_expectingRepliesTo[bucket][i] == packetId)
if (_expectingRepliesTo[bucket][i] == packetId) {
_expectingRepliesTo[bucket][i] = 0;
return true;
}
}
return false;
}