diff options
| author | Grant Limberg <grant.limberg@zerotier.com> | 2017-01-05 11:43:26 -0800 |
|---|---|---|
| committer | Grant Limberg <grant.limberg@zerotier.com> | 2017-01-05 11:43:26 -0800 |
| commit | e2b1a7157e3ba7b3cb342582acbdeb22033d7b84 (patch) | |
| tree | 38507f40e921d42534d39f103dc92923b6e1ce34 /osdep | |
| parent | aaf69d1aff59a244990e1c3c1de4ef6bf6ac6a3b (diff) | |
| download | infinitytier-e2b1a7157e3ba7b3cb342582acbdeb22033d7b84.tar.gz infinitytier-e2b1a7157e3ba7b3cb342582acbdeb22033d7b84.zip | |
Potential fix for routing issue on Windows
Move setting _initialized = true until after WindowsEthernetTap::threadMain() has actually created and brought up the adapter. Also in OneService::nodeVirtualNetworkConfigFunction(), wait up to 5 seconds for WindowsEthernatTap::isInitialized() to return true before attempting to configure the interface and managed routes. Without this, the adapter doesnt actually exist yet when trying to add routes
Diffstat (limited to 'osdep')
| -rw-r--r-- | osdep/WindowsEthernetTap.cpp | 6 | ||||
| -rw-r--r-- | osdep/WindowsEthernetTap.hpp | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp index a9ff31d3..8ee088bb 100644 --- a/osdep/WindowsEthernetTap.cpp +++ b/osdep/WindowsEthernetTap.cpp @@ -640,7 +640,7 @@ WindowsEthernetTap::WindowsEthernetTap( if (ConvertInterfaceGuidToLuid(&_deviceGuid,&_deviceLuid) != NO_ERROR) throw std::runtime_error("unable to convert device interface GUID to LUID"); - _initialized = true; + //_initialized = true; if (friendlyName) setFriendlyName(friendlyName); @@ -1007,6 +1007,10 @@ void WindowsEthernetTap::threadMain() ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead); bool writeInProgress = false; ULONGLONG timeOfLastBorkCheck = GetTickCount64(); + + + _initialized = true; + while (_run) { DWORD waitResult = WaitForMultipleObjectsEx(writeInProgress ? 3 : 2,wait4,FALSE,2500,TRUE); if (!_run) break; // will also break outer while(_run) diff --git a/osdep/WindowsEthernetTap.hpp b/osdep/WindowsEthernetTap.hpp index 0bbb17d8..74b37f8c 100644 --- a/osdep/WindowsEthernetTap.hpp +++ b/osdep/WindowsEthernetTap.hpp @@ -110,12 +110,17 @@ public: void threadMain() throw(); + bool isInitialized() const { return _initialized; }; + private: NET_IFINDEX _getDeviceIndex(); // throws on failure std::vector<std::string> _getRegistryIPv4Value(const char *regKey); void _setRegistryIPv4Value(const char *regKey,const std::vector<std::string> &value); void _syncIps(); + // clean up invalid values put into the windows registry + // void _cleanRegistry(); + void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int); void *_arg; MAC _mac; |
