if (netdev->ifindex == 0)
continue;
- /* Recent kernels already delete the virtual devices */
- if (netdev->type != LXC_NET_PHYS)
+ if (netdev->type == LXC_NET_PHYS) {
+ if (lxc_netdev_rename_by_index(netdev->ifindex, netdev->link))
+ WARN("failed to rename to the initial name the " \
+ "netdev '%s'", netdev->link);
continue;
+ }
- if (lxc_netdev_rename_by_index(netdev->ifindex, netdev->link))
- WARN("failed to rename to the initial name the netdev '%s'",
- netdev->link);
+ /* Recent kernel remove the virtual interfaces when the network
+ * namespace is destroyed but in case we did not moved the
+ * interface to the network namespace, we have to destroy it
+ */
+ if (lxc_netdev_delete_by_index(netdev->ifindex))
+ WARN("failed to remove interface '%s'", netdev->name);
}
}
}
}
-
/* Create a process in a new set of namespaces */
handler->pid = lxc_clone(do_start, handler, clone_flags);
if (handler->pid < 0) {