kernel-pfroute: Raise tun event when creating/destroying TUN devices for virtual IPs

This commit is contained in:
Tobias Brunner
2013-06-21 17:03:21 +02:00
parent 4868d1c3bc
commit 554c4276a5
@@ -878,7 +878,10 @@ METHOD(kernel_net_t, add_ip, status_t,
}
}
ifaces->destroy(ifaces);
/* lets do this while holding the lock, thus preventing another thread
* from deleting the TUN device concurrently, hopefully listeneres are quick
* and cause no deadlocks */
hydra->kernel_interface->tun(hydra->kernel_interface, tun, TRUE);
this->lock->unlock(this->lock);
return SUCCESS;
@@ -901,6 +904,8 @@ METHOD(kernel_net_t, del_ip, status_t,
if (addr && addr->ip_equals(addr, vip))
{
this->tuns->remove_at(this->tuns, enumerator);
hydra->kernel_interface->tun(hydra->kernel_interface, tun,
FALSE);
tun->destroy(tun);
found = TRUE;
break;