diff options
| author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2014-01-26 22:47:08 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2014-01-26 22:47:08 -0800 |
| commit | afbbf615882b75171e05ca12e64697ec322d8ff7 (patch) | |
| tree | 4bad1a8c88d711d6755a68d1d366409776b8af7c /node/Network.cpp | |
| parent | 28665079a01d26345e1289f2eaaca3307f83ac29 (diff) | |
| download | infinitytier-afbbf615882b75171e05ca12e64697ec322d8ff7.tar.gz infinitytier-afbbf615882b75171e05ca12e64697ec322d8ff7.zip | |
Delete persistent tap device on Windows when we leave a network.
Diffstat (limited to 'node/Network.cpp')
| -rw-r--r-- | node/Network.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index af7623c1..37d93b99 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -36,6 +36,7 @@ #include "Switch.hpp" #include "Packet.hpp" #include "Buffer.hpp" +#include "EthernetTap.hpp" #define ZT_NETWORK_CERT_WRITE_BUF_SIZE 131072 @@ -55,13 +56,14 @@ const char *Network::statusString(const Status s) Network::~Network() { + std::string devPersistentId(_tap->persistentId()); delete _tap; + if (_destroyOnDelete) { Utils::rm(std::string(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d" + ZT_PATH_SEPARATOR_S + idString() + ".conf")); Utils::rm(std::string(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d" + ZT_PATH_SEPARATOR_S + idString() + ".mcerts")); - - // TODO: on Windows we need to also remove the tap interface since they're - // sticky on that platform. + if (devPersistentId.length()) + EthernetTap::deletePersistentTapDevice(_r,devPersistentId.c_str()); } else { // Causes flush of membership certs to disk clean(); |
