diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-01-10 14:31:31 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-01-10 14:31:31 -0800 |
commit | 6304c85d3fe81ee6d89584e70e0af0d206f44997 (patch) | |
tree | b6888433ace4c36c380ea335ced1ab8f89845723 /osdep | |
parent | a1992d76f2026c784c8a4f15bf1a4ef164ae74c6 (diff) | |
parent | 98b07f7f3c100bce017669f6a904ee5dace47412 (diff) | |
download | infinitytier-6304c85d3fe81ee6d89584e70e0af0d206f44997.tar.gz infinitytier-6304c85d3fe81ee6d89584e70e0af0d206f44997.zip |
Merge branch 'dev' of http://10.6.6.2/zerotier/ZeroTierOne into dev
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/Binder.hpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp index 2c42daee..e10c0080 100644 --- a/osdep/Binder.hpp +++ b/osdep/Binder.hpp @@ -137,6 +137,7 @@ public: std::map<InetAddress,std::string> localIfAddrs; PhySocket *udps,*tcps; Mutex::Lock _l(_lock); + bool interfacesEnumerated = true; #ifdef __WINDOWS__ @@ -167,6 +168,9 @@ public: a = a->Next; } } + else { + interfacesEnumerated = false; + } #else // not __WINDOWS__ @@ -195,6 +199,9 @@ public: } fclose(procf); } + else { + interfacesEnumerated = false; + } // Get IPv6 addresses (and any device names we don't already know) OSUtils::ztsnprintf(fn,sizeof(fn),"/proc/%lu/net/if_inet6",pid); @@ -314,12 +321,15 @@ public: } freeifaddrs(ifatbl); } + else { + interfacesEnumerated = false; + } } #endif // Default to binding to wildcard if we can't enumerate addresses - if (localIfAddrs.empty()) { + if (!interfacesEnumerated && localIfAddrs.empty()) { for(int x=0;x<(int)portCount;++x) { localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((uint32_t)0,ports[x]),std::string())); localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((const void *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",16,ports[x]),std::string())); |