summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ZeroTierOne.h6
-rw-r--r--service/OneService.cpp8
2 files changed, 12 insertions, 2 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h
index 377af63f..18776ad8 100644
--- a/include/ZeroTierOne.h
+++ b/include/ZeroTierOne.h
@@ -1334,8 +1334,10 @@ void ZT_Node_freeQueryResult(ZT_Node *node,void *qr);
/**
* Add a local interface address
*
- * Take care that these are never ZeroTier interface addresses, otherwise
- * strange things might happen or they simply won't work.
+ * It is the responsibility of the caller to take care that these are never
+ * ZeroTier interface addresses, whether these are assigned by ZeroTier or
+ * are otherwise assigned to an interface managed by this ZeroTier instance.
+ * This can cause recursion or other undesirable behavior.
*
* Addresses can also be added here if they are the result of a UPnP or
* NAT-PMP port mapping or other discovery or mapping means.
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 6e4ba904..f17d2194 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -811,6 +811,14 @@ public:
ztDevices.push_back(t->second->luid());
}
+ _node->clearLocalInterfaceAddresses();
+
+#ifdef ZT_USE_MINIUPNPC
+ std::vector<InetAddress> mappedAddresses(_portMapper->get());
+ for(std::vector<InetAddress>::const_iterator ext(mappedAddresses.begin());ext!=mappedAddresses.end();++ext)
+ _node->addLocalInterfaceAddress(reinterpret_cast<const struct sockaddr_storage *>(&(*ext)));
+#endif
+
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) {