diff options
author | Martin Willi <martin@revosec.ch> | 2013-04-19 10:46:04 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-05-06 16:10:12 +0200 |
commit | 0fd409db772cd70972eab7cadd516e705946a882 (patch) | |
tree | 84b6b38b29c8665bc0a06603f2daeeb8d3db5580 /src | |
parent | 9bc342eae471831ca328e00a6bf65be1b2608f7a (diff) | |
download | strongswan-0fd409db772cd70972eab7cadd516e705946a882.tar.bz2 strongswan-0fd409db772cd70972eab7cadd516e705946a882.tar.xz |
kernel-pfroute: add newly appearing interfaces to the interface cache
Diffstat (limited to 'src')
-rw-r--r-- | src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c | 23 |
1 files changed, 22 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 face73e6b..0d12a875b 100644 --- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c +++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c @@ -472,7 +472,7 @@ static void process_link(private_kernel_pfroute_net_t *this, { enumerator_t *enumerator; iface_entry_t *iface; - bool roam = FALSE; + bool roam = FALSE, found = FALSE;; this->lock->write_lock(this->lock); enumerator = this->ifaces->create_enumerator(this->ifaces); @@ -494,10 +494,31 @@ static void process_link(private_kernel_pfroute_net_t *this, } } iface->flags = msg->ifm_flags; + found = TRUE; break; } } enumerator->destroy(enumerator); + + if (!found) + { + INIT(iface, + .ifindex = msg->ifm_index, + .flags = msg->ifm_flags, + .addrs = linked_list_create(), + ); + if (if_indextoname(iface->ifindex, iface->ifname)) + { + DBG1(DBG_KNL, "interface %s appeared", iface->ifname); + iface->usable = hydra->kernel_interface->is_interface_usable( + hydra->kernel_interface, iface->ifname); + this->ifaces->insert_last(this->ifaces, iface); + } + else + { + free(iface); + } + } this->lock->unlock(this->lock); if (roam) |