summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2019-03-26 15:23:51 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2019-03-26 15:23:51 -0700
commitee8682ac75b5b97038a52953b66e26b94d6410c8 (patch)
tree4920200ff05a8d006aae1572edf067fc4915f41d
parente3e5137757de9aa1f16fd2f6669fff9ac951e782 (diff)
downloadinfinitytier-ee8682ac75b5b97038a52953b66e26b94d6410c8.tar.gz
infinitytier-ee8682ac75b5b97038a52953b66e26b94d6410c8.zip
Temporarily disable the symmetric NAT port prediction code since the current version adds protocol overhead and probably is not that effective.
-rw-r--r--node/Peer.cpp15
-rw-r--r--node/SelfAwareness.cpp2
-rw-r--r--node/SelfAwareness.hpp2
3 files changed, 13 insertions, 6 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 2ab186c3..b0c7db77 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -163,6 +163,7 @@ void Peer::received(
}
} else break;
}
+
// If the path isn't a duplicate of the same localSocket AND we haven't already determined a replacePath,
// then find the worst path and replace it.
if (!redundant && replacePath == ZT_MAX_PEER_NETWORK_PATHS) {
@@ -180,6 +181,7 @@ void Peer::received(
}
}
}
+
if (replacePath != ZT_MAX_PEER_NETWORK_PATHS) {
if (verb == Packet::VERB_OK) {
RR->t->peerLearnedNewPath(tPtr,networkId,*this,path,packetId);
@@ -203,15 +205,14 @@ void Peer::received(
// all known external addresses for ourselves. We now do this even if we
// have a current path since we'll want to use new ones too.
if (this->trustEstablished(now)) {
- if ((now - _lastDirectPathPushSent) >= ZT_DIRECT_PATH_PUSH_INTERVAL) {
+ const uint64_t sinceLastPush = now - _lastDirectPathPushSent;
+ if (sinceLastPush >= ZT_DIRECT_PATH_PUSH_INTERVAL) {
_lastDirectPathPushSent = now;
- std::vector<InetAddress> pathsToPush;
-
- std::vector<InetAddress> dps(RR->node->directPaths());
- for(std::vector<InetAddress>::const_iterator i(dps.begin());i!=dps.end();++i)
- pathsToPush.push_back(*i);
+ // Start with explicitly known direct endpoint paths.
+ std::vector<InetAddress> pathsToPush(RR->node->directPaths());
+#if 0
// Do symmetric NAT prediction if we are communicating indirectly.
if (hops > 0) {
std::vector<InetAddress> sym(RR->sa->getSymmetricNatPredictions());
@@ -224,6 +225,7 @@ void Peer::received(
}
}
}
+#endif
if (pathsToPush.size() > 0) {
std::vector<InetAddress>::const_iterator p(pathsToPush.begin());
@@ -258,6 +260,7 @@ void Peer::received(
if (count) {
outp.setAt(ZT_PACKET_IDX_PAYLOAD,(uint16_t)count);
+ outp.compress();
outp.armor(_key,true);
path->send(RR,tPtr,outp.data(),outp.size(),now);
}
diff --git a/node/SelfAwareness.cpp b/node/SelfAwareness.cpp
index 61db22ea..225d1dc2 100644
--- a/node/SelfAwareness.cpp
+++ b/node/SelfAwareness.cpp
@@ -124,6 +124,7 @@ void SelfAwareness::clean(int64_t now)
}
}
+#if 0
std::vector<InetAddress> SelfAwareness::getSymmetricNatPredictions()
{
/* This is based on ideas and strategies found here:
@@ -206,5 +207,6 @@ std::vector<InetAddress> SelfAwareness::getSymmetricNatPredictions()
return r;
}
+#endif
} // namespace ZeroTier
diff --git a/node/SelfAwareness.hpp b/node/SelfAwareness.hpp
index 6bfe5f10..c03d4cb6 100644
--- a/node/SelfAwareness.hpp
+++ b/node/SelfAwareness.hpp
@@ -64,12 +64,14 @@ public:
*/
void clean(int64_t now);
+#if 0
/**
* If we appear to be behind a symmetric NAT, get predictions for possible external endpoints
*
* @return Symmetric NAT predictions or empty vector if none
*/
std::vector<InetAddress> getSymmetricNatPredictions();
+#endif
private:
struct PhySurfaceKey