kernel-netlink: Set usable state whenever an interface appears
authorTobias Brunner <tobias@strongswan.org>
Mon, 14 Aug 2017 15:26:08 +0000 (17:26 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 23 Aug 2017 10:10:39 +0000 (12:10 +0200)
If an interface is renamed we already have an entry (based on the
ifindex) allocated but previously only set the usable state once
based on the original name.

Fixes #2403.

src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c

index 0dd3e30..a21d0ae 100644 (file)
@@ -1183,13 +1183,13 @@ static void process_link(private_kernel_netlink_net_t *this,
                                INIT(entry,
                                        .ifindex = msg->ifi_index,
                                        .addrs = linked_list_create(),
-                                       .usable = charon->kernel->is_interface_usable(
-                                                                                                               charon->kernel, name),
                                );
                                this->ifaces->insert_last(this->ifaces, entry);
                        }
                        strncpy(entry->ifname, name, IFNAMSIZ);
                        entry->ifname[IFNAMSIZ-1] = '\0';
+                       entry->usable = charon->kernel->is_interface_usable(charon->kernel,
+                                                                                                                               name);
                        if (event && entry->usable)
                        {
                                if (!(entry->flags & IFF_UP) && (msg->ifi_flags & IFF_UP))