From 607d8f72e81aa0e76455a16ee8f7492d059aff8d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 15 Aug 2019 15:43:35 -0700 Subject: [PATCH] cruftectomy --- node/IncomingPacket.cpp | 12 ++++-------- node/Packet.hpp | 19 ++++--------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 78332a40d..c1bfdbf6c 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -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(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(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); diff --git a/node/Packet.hpp b/node/Packet.hpp index 3a2780ded..51be67ac5 100644 --- a/node/Packet.hpp +++ b/node/Packet.hpp @@ -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); } /**