From: Tobias Brunner Date: Thu, 13 Jun 2013 15:51:16 +0000 (+0200) Subject: kernel-pfroute: Raise tun event when creating/destroying TUN devices for virtual IPs X-Git-Tag: 5.1.0dr1~80^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=554c4276a5afec3fb28562c757791258c5803c9e;p=thirdparty%2Fstrongswan.git kernel-pfroute: Raise tun event when creating/destroying TUN devices for virtual IPs --- diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c index 6c0b457c5e..520f52a6cf 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;