diff options
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index bdeca701..1934ef7d 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -493,10 +493,10 @@ int Node::addLocalInterfaceAddress(const struct sockaddr_storage *addr) { if (Path::isAddressValidForPath(*(reinterpret_cast<const InetAddress *>(addr)))) { Mutex::Lock _l(_directPaths_m); - _directPaths.push_back(*(reinterpret_cast<const InetAddress *>(addr))); - std::sort(_directPaths.begin(),_directPaths.end()); - _directPaths.erase(std::unique(_directPaths.begin(),_directPaths.end()),_directPaths.end()); - return 1; + if (std::find(_directPaths.begin(),_directPaths.end(),*(reinterpret_cast<const InetAddress *>(addr))) == _directPaths.end()) { + _directPaths.push_back(*(reinterpret_cast<const InetAddress *>(addr))); + return 1; + } } return 0; } @@ -670,6 +670,9 @@ std::string Node::dataStoreGet(const char *name) bool Node::shouldUsePathForZeroTierTraffic(const InetAddress &localAddress,const InetAddress &remoteAddress) { + if (!Path::isAddressValidForPath(remoteAddress)) + return false; + { Mutex::Lock _l(_networks_m); for(std::vector< std::pair< uint64_t, SharedPtr<Network> > >::const_iterator i=_networks.begin();i!=_networks.end();++i) { |
