aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-06-13 17:51:16 +0200
committerTobias Brunner <tobias@strongswan.org>2013-06-21 17:03:21 +0200
commit554c4276a5afec3fb28562c757791258c5803c9e (patch)
treebf23a637c4c327dfdebf766daf46a207fa92d4d9
parent4868d1c3bce7c126c2ce539e7b2b733365054fb6 (diff)
downloadstrongswan-554c4276a5afec3fb28562c757791258c5803c9e.tar.bz2
strongswan-554c4276a5afec3fb28562c757791258c5803c9e.tar.xz
kernel-pfroute: Raise tun event when creating/destroying TUN devices for virtual IPs
-rw-r--r--src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
index 6c0b457c5..520f52a6c 100644
--- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
+++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
@@ -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;