aboutsummaryrefslogtreecommitdiffstats
path: root/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
diff options
context:
space:
mode:
authorMirko Parthey <mirko.parthey@informatik.tu-chemnitz.de>2011-11-14 15:24:48 +0100
committerTobias Brunner <tobias@strongswan.org>2011-11-14 15:24:48 +0100
commit7b21873668ec818c4988f69547460ef33d4bd3ac (patch)
tree842b9f2c8f49f00f6a770284e8d4de3a08cf7fa0 /src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
parent18f85b668d10ea46c1c716983fed072bce5eefb3 (diff)
downloadstrongswan-7b21873668ec818c4988f69547460ef33d4bd3ac.tar.bz2
strongswan-7b21873668ec818c4988f69547460ef33d4bd3ac.tar.xz
Fix network interface deletion handling in kernel-netlink plugin.
When the kernel reports the deletion of an interface (RTM_DELLINK), the cached interface attributes, including ifindex, become invalid and must be forgotten. Interface link state changes ("up" and "down") show up as RTM_NEWLINK, so they will not cause a cached entry to be removed or prevent listening to address change notifications. Once an interface has been deleted, the kernel ought to stop sending notifications for it. If the interface gets recreated with the same name later, the kernel again reports RTM_NEWLINK, which causes a new cache entry to be created. There should be no reason to keep a stale cache entry around, as was claimed in the comment.
Diffstat (limited to 'src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c')
-rw-r--r--src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
index 219657541..31f384460 100644
--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
+++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_net.c
@@ -375,9 +375,13 @@ static void process_link(private_kernel_netlink_net_t *this,
{
if (current->ifindex == msg->ifi_index)
{
- /* we do not remove it, as an address may be added to a
- * "down" interface and we wan't to know that. */
- current->flags = msg->ifi_flags;
+ if (event)
+ {
+ update = TRUE;
+ DBG1(DBG_KNL, "interface %s deleted", current->ifname);
+ }
+ this->ifaces->remove_at(this->ifaces, enumerator);
+ iface_entry_destroy(current);
break;
}
}