From afbbf615882b75171e05ca12e64697ec322d8ff7 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 26 Jan 2014 22:47:08 -0800 Subject: Delete persistent tap device on Windows when we leave a network. --- node/Network.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'node/Network.cpp') 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(); -- cgit v1.2.3