mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-13 19:26:15 +00:00
Fix network cleanup on error
Network cleanup does not cleanup correctly the virtual interfaces in case of an error. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
f0e64b8b66
commit
d8f8e35202
@ -1702,13 +1702,19 @@ void lxc_delete_network(struct lxc_list *network)
|
|||||||
if (netdev->ifindex == 0)
|
if (netdev->ifindex == 0)
|
||||||
continue;
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (lxc_netdev_rename_by_index(netdev->ifindex, netdev->link))
|
/* Recent kernel remove the virtual interfaces when the network
|
||||||
WARN("failed to rename to the initial name the netdev '%s'",
|
* namespace is destroyed but in case we did not moved the
|
||||||
netdev->link);
|
* 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,6 @@ int lxc_spawn(struct lxc_handler *handler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create a process in a new set of namespaces */
|
/* Create a process in a new set of namespaces */
|
||||||
handler->pid = lxc_clone(do_start, handler, clone_flags);
|
handler->pid = lxc_clone(do_start, handler, clone_flags);
|
||||||
if (handler->pid < 0) {
|
if (handler->pid < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user