summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--node/IncomingPacket.cpp8
-rw-r--r--service/OneService.cpp43
-rw-r--r--windows/ZeroTierOne/ZeroTierOne.vcxproj1
-rw-r--r--windows/ZeroTierOne/ZeroTierOne.vcxproj.filters3
4 files changed, 51 insertions, 4 deletions
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp
index 87669ba7..c1594f81 100644
--- a/node/IncomingPacket.cpp
+++ b/node/IncomingPacket.cpp
@@ -899,13 +899,17 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,const Sha
switch(addrType) {
case 4: {
InetAddress a(field(ptr,4),4,at<uint16_t>(ptr + 4));
- if ((flags & (0x01 | 0x02)) == 0)
+ if ((flags & (0x01 | 0x02)) == 0) {
+ printf("contacting %s at %s\r\n",peer->address().toString().c_str(),a.toString().c_str());
peer->attemptToContactAt(RR,a,RR->node->now());
+ }
} break;
case 6: {
InetAddress a(field(ptr,16),16,at<uint16_t>(ptr + 16));
- if ((flags & (0x01 | 0x02)) == 0)
+ if ((flags & (0x01 | 0x02)) == 0) {
+ printf("contacting %s at %s\r\n",peer->address().toString().c_str(),a.toString().c_str());
peer->attemptToContactAt(RR,a,RR->node->now());
+ }
} break;
}
ptr += addrLen;
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 109050bf..527ac1b0 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -75,7 +75,11 @@ class SqliteNetworkController;
#endif // ZT_ENABLE_NETWORK_CONTROLLER
#ifdef __WINDOWS__
+#include <WinSock2.h>
+#include <Windows.h>
#include <ShlObj.h>
+#include <netioapi.h>
+#include <iphlpapi.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
@@ -614,10 +618,45 @@ public:
{
Mutex::Lock _l(_taps_m);
for(std::map< uint64_t,EthernetTap *>::const_iterator t(_taps.begin());t!=_taps.end();++t)
- ztDevices.push_back(t->second->deviceName());
+ ztDevices.push_back(t->second->luid());
}
- // TODO
+ char aabuf[16384];
+ ULONG aalen = sizeof(aabuf);
+ if (GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_SKIP_ANYCAST|GAA_FLAG_SKIP_MULTICAST|GAA_FLAG_SKIP_DNS_SERVER,(void *)0,reinterpret_cast<PIP_ADAPTER_ADDRESSES>(aabuf),&aalen) == NO_ERROR) {
+ PIP_ADAPTER_ADDRESSES a = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(aabuf);
+ while (a) {
+ bool isZT = false;
+ for(std::vector<NET_LUID>::const_iterator d(ztDevices.begin());d!=ztDevices.end();++d) {
+ if (a->Luid.Value == d->Value) {
+ isZT = true;
+ break;
+ }
+ }
+ if (!isZT) {
+ PIP_ADAPTER_UNICAST_ADDRESS ua = a->FirstUnicastAddress;
+ while (ua) {
+ InetAddress ip(ua->Address.lpSockaddr);
+ if ((ip.ss_family == AF_INET)||(ip.ss_family == AF_INET6)) {
+ switch(ip.ipScope()) {
+ case InetAddress::IP_SCOPE_LINK_LOCAL:
+ case InetAddress::IP_SCOPE_PRIVATE:
+ case InetAddress::IP_SCOPE_PSEUDOPRIVATE:
+ case InetAddress::IP_SCOPE_SHARED:
+ case InetAddress::IP_SCOPE_GLOBAL:
+ ip.setPort(_port);
+ _node->addLocalInterfaceAddress(reinterpret_cast<const struct sockaddr_storage *>(&ip),0,ZT1_LOCAL_INTERFACE_ADDRESS_TRUST_NORMAL,0);
+ break;
+ default:
+ break;
+ }
+ }
+ ua = ua->Next;
+ }
+ }
+ a = a->Next;
+ }
+ }
#endif // __WINDOWS__
}
diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj b/windows/ZeroTierOne/ZeroTierOne.vcxproj
index acd4c7fe..554669b6 100644
--- a/windows/ZeroTierOne/ZeroTierOne.vcxproj
+++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj
@@ -94,6 +94,7 @@
<ClInclude Include="..\..\node\Path.hpp" />
<ClInclude Include="..\..\node\Peer.hpp" />
<ClInclude Include="..\..\node\Poly1305.hpp" />
+ <ClInclude Include="..\..\node\RemotePath.hpp" />
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp" />
<ClInclude Include="..\..\node\Salsa20.hpp" />
<ClInclude Include="..\..\node\SelfAwareness.hpp" />
diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
index 9337a88e..f36b5dc0 100644
--- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
+++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters
@@ -344,6 +344,9 @@
<ClInclude Include="..\..\osdep\BackgroundResolver.hpp">
<Filter>Header Files\osdep</Filter>
</ClInclude>
+ <ClInclude Include="..\..\node\RemotePath.hpp">
+ <Filter>Header Files\node</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ZeroTierOne.rc">