diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-28 11:28:47 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-28 11:28:47 -0700 |
| commit | b31071463cafda54afbf6f01d37aa7451b217b12 (patch) | |
| tree | d1a51ac050d3935a868dd2187d73d86e69f85190 /node/SelfAwareness.cpp | |
| parent | dda376c9eb0800b824f423db30399d93e89cb162 (diff) | |
| download | infinitytier-b31071463cafda54afbf6f01d37aa7451b217b12.tar.gz infinitytier-b31071463cafda54afbf6f01d37aa7451b217b12.zip | |
Try another NAT traversal improvement.
Diffstat (limited to 'node/SelfAwareness.cpp')
| -rw-r--r-- | node/SelfAwareness.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/node/SelfAwareness.cpp b/node/SelfAwareness.cpp index 00015788..716cf7f3 100644 --- a/node/SelfAwareness.cpp +++ b/node/SelfAwareness.cpp @@ -147,4 +147,19 @@ void SelfAwareness::clean(uint64_t now) } } +bool SelfAwareness::areGlobalIPv4PortsRandomized() const +{ + int port = 0; + Mutex::Lock _l(_phy_m); + for(std::map< PhySurfaceKey,PhySurfaceEntry >::const_iterator p(_phy.begin());p!=_phy.end();++p) { + if ((p->first.scope == InetAddress::IP_SCOPE_GLOBAL)&&(p->second.mySurface.ss_family == AF_INET)) { + const int tmp = (int)p->second.mySurface.port(); + if ((port)&&(tmp != port)) + return true; + else port = tmp; + } + } + return false; +} + } // namespace ZeroTier |
