Delete persistent tap device on Windows when we leave a network.

This commit is contained in:
Adam Ierymenko 2014-01-26 22:47:08 -08:00
parent 28665079a0
commit afbbf61588
3 changed files with 101 additions and 28 deletions

View file

@ -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();