From db952a050a727717a5cd836c79a50d7504a9b9ef Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 8 Feb 2018 14:15:32 -0800 Subject: [PATCH 1/2] Added platform checks for Windows in OneService --- service/OneService.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 27b71141e..4854d68d8 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1593,7 +1593,7 @@ public: if (syncRoutes) { char tapdev[64]; -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(ZT_SDK) OSUtils::ztsnprintf(tapdev,sizeof(tapdev),"%.16llx",(unsigned long long)n.tap->luid().Value); #else Utils::scopy(tapdev,sizeof(tapdev),n.tap->deviceName().c_str()); @@ -1998,7 +1998,7 @@ public: case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE: ZT_FAST_MEMCPY(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig)); if (n.tap) { // sanity check -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(ZT_SDK) // wait for up to 5 seconds for the WindowsEthernetTap to actually be initialized // // without WindowsEthernetTap::isInitialized() returning true, the won't actually @@ -2019,7 +2019,7 @@ public: case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN: case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY: if (n.tap) { // sanity check -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(ZT_SDK) std::string winInstanceId(n.tap->instanceId()); #endif *nuptr = (void *)0; From 51aadcf9017c9c4b1c86302fa3bb65cc67dcc05b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 9 Feb 2018 06:35:01 +0000 Subject: [PATCH 2/2] A few fixes dicatated by valgrind. --- node/Dictionary.hpp | 53 +++++++++++++++++---------------------------- node/Switch.cpp | 1 + 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/node/Dictionary.hpp b/node/Dictionary.hpp index 59afb7c61..f89b6ffcc 100644 --- a/node/Dictionary.hpp +++ b/node/Dictionary.hpp @@ -62,40 +62,24 @@ template class Dictionary { public: - Dictionary() - { - _d[0] = (char)0; - } - - Dictionary(const char *s) - { - if (s) { - Utils::scopy(_d,sizeof(_d),s); - } else { - _d[0] = (char)0; - } - } - + Dictionary() { memset(_d,0,sizeof(_d)); } + Dictionary(const char *s) { this->load(s); } Dictionary(const char *s,unsigned int len) { - if (s) { - if (len > (C-1)) - len = C-1; - ZT_FAST_MEMCPY(_d,s,len); - _d[len] = (char)0; - } else { - _d[0] = (char)0; + for(unsigned int i=0;i