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

@ -175,6 +175,11 @@ public:
*/
std::string deviceName() const;
/**
* @return OS-internal persistent device ID or empty string if not applicable to this platform or not persistent
*/
std::string persistentId() const;
/**
* Fill or modify a set to contain multicast groups for this device
*
@ -195,6 +200,19 @@ public:
void threadMain()
throw();
/**
* Remove persistent tap device by device name
*
* This has no effect on platforms that do not have persistent taps.
* On platforms like Windows with persistent devices the device is
* uninstalled.
*
* @param _r Runtime environment
* @param pdev Device name as returned by persistentId() while tap is running
* @return True if a device was deleted
*/
static bool deletePersistentTapDevice(const RuntimeEnvironment *_r,const char *pid);
private:
const MAC _mac;
const unsigned int _mtu;
@ -215,6 +233,8 @@ private:
#endif
#ifdef __WINDOWS__
void _syncIpsWithRegistry(const std::set<InetAddress> &haveIps);
HANDLE _tap;
OVERLAPPED _tapOvlRead,_tapOvlWrite;
char _tapReadBuf[ZT_IF_MTU + 32];