cruftectomy

This commit is contained in:
Adam Ierymenko 2019-08-15 15:43:35 -07:00
parent c483f75fb4
commit 607d8f72e8
No known key found for this signature in database
GPG Key ID: 1657198823E52A61
2 changed files with 8 additions and 23 deletions

View File

@ -1096,10 +1096,8 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,void *tPt
switch(addrType) {
case 4: {
const InetAddress a(field(ptr,4),4,at<uint16_t>(ptr + 4));
if (
((flags & ZT_PUSH_DIRECT_PATHS_FLAG_FORGET_PATH) == 0) && // not being told to forget
(!( ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) == 0) && (peer->hasActivePathTo(now,a)) )) && // not already known
(RR->node->shouldUsePathForZeroTierTraffic(tPtr,peer->address(),_path->localSocket(),a)) ) // should use path
if ((!( ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) == 0) && (peer->hasActivePathTo(now,a)) )) && // not already known
(RR->node->shouldUsePathForZeroTierTraffic(tPtr,peer->address(),_path->localSocket(),a)) ) // should use path
{
if ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) != 0) {
peer->clusterRedirect(tPtr,_path,a,now);
@ -1110,10 +1108,8 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,void *tPt
} break;
case 6: {
const InetAddress a(field(ptr,16),16,at<uint16_t>(ptr + 16));
if (
((flags & ZT_PUSH_DIRECT_PATHS_FLAG_FORGET_PATH) == 0) && // not being told to forget
(!( ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) == 0) && (peer->hasActivePathTo(now,a)) )) && // not already known
(RR->node->shouldUsePathForZeroTierTraffic(tPtr,peer->address(),_path->localSocket(),a)) ) // should use path
if ((!( ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) == 0) && (peer->hasActivePathTo(now,a)) )) && // not already known
(RR->node->shouldUsePathForZeroTierTraffic(tPtr,peer->address(),_path->localSocket(),a)) ) // should use path
{
if ((flags & ZT_PUSH_DIRECT_PATHS_FLAG_CLUSTER_REDIRECT) != 0) {
peer->clusterRedirect(tPtr,_path,a,now);

View File

@ -94,12 +94,12 @@
#define ZT_PROTO_MAX_HOPS 7
/**
* Cipher suite: Poly1305/NONE
* NONE/Poly1305 (using Salsa20/12 to generate poly1305 key)
*/
#define ZT_PROTO_CIPHER_SUITE__POLY1305_NONE 0
/**
* Cipher suite: Poly1305/Salsa2012
* Salsa2012/Poly1305
*/
#define ZT_PROTO_CIPHER_SUITE__POLY1305_SALSA2012 1
@ -116,11 +116,9 @@
#define ZT_PROTO_CIPHER_SUITE__NO_CRYPTO_TRUSTED_PATH 2
/**
* DEPRECATED payload encrypted flag, may be re-used in the future.
*
* This has been replaced by the three-bit cipher suite selection field.
* AES256/GCM
*/
#define ZT_PROTO_FLAG_ENCRYPTED 0x80
#define ZT_PROTO_CIPHER_SUITE__AES256_GCM 3
/**
* Header flag indicating that a packet is fragmented
@ -135,11 +133,6 @@
*/
#define ZT_PROTO_VERB_FLAG_COMPRESSED 0x80
/**
* PUSH_DIRECT_PATHS flag: forget path
*/
#define ZT_PUSH_DIRECT_PATHS_FLAG_FORGET_PATH 0x01
/**
* PUSH_DIRECT_PATHS flag: cluster redirect
*/
@ -1098,10 +1091,6 @@ public:
{
unsigned char &b = (*this)[ZT_PACKET_IDX_FLAGS];
b = (b & 0xc7) | (unsigned char)((c << 3) & 0x38); // bits: FFCCCHHH
// Set DEPRECATED "encrypted" flag -- used by pre-1.0.3 peers
if (c == ZT_PROTO_CIPHER_SUITE__POLY1305_SALSA2012)
b |= ZT_PROTO_FLAG_ENCRYPTED;
else b &= (~ZT_PROTO_FLAG_ENCRYPTED);
}
/**