summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2015-04-24 16:31:19 -0700
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2015-04-24 16:31:19 -0700
commitce09e363dc95d801e8707a29a0d585089d6c3d09 (patch)
tree276ad50650b18f93eac77be8c9b0f7dbf0a99f9c /service
parente2c65bf16a9b6f30daf023a9cfc270354d351387 (diff)
downloadinfinitytier-ce09e363dc95d801e8707a29a0d585089d6c3d09.tar.gz
infinitytier-ce09e363dc95d801e8707a29a0d585089d6c3d09.zip
Destroy tap devices on Windows 'leave'.
Diffstat (limited to 'service')
-rw-r--r--service/OneService.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index c32fb792..bff70500 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -461,9 +461,16 @@ public:
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
if (t != _taps.end()) {
+#ifdef __WINDOWS__
+ std::string winInstanceId(t->second->instanceId());
+#endif
delete t->second;
_taps.erase(t);
_tapAssignedIps.erase(nwid);
+#ifdef __WINDOWS__
+ if ((op == ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY)&&(winInstanceId.length() > 0))
+ WindowsEthernetTap::deletePersistentTapDevice(_homePath.c_str(),winInstanceId.c_str());
+#endif
}
break;
}