network: fix network device removal

Closes #2849. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent c5aab2fc
......@@ -2574,17 +2574,16 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
* interface to the network namespace, we have to destroy it.
*/
ret = lxc_netdev_delete_by_index(netdev->ifindex);
if (-ret == ENODEV) {
INFO("Interface \"%s\" with index %d already "
"deleted or existing in different network "
"namespace",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
} else if (ret < 0) {
WARN("Failed to remove interface \"%s\" with index %d",
if (ret < 0) {
if (errno != ENODEV) {
WARN("Failed to remove interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
goto clear_ifindices;
}
INFO("Interface \"%s\" with index %d already deleted or existing in different network namespace",
netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex);
goto clear_ifindices;
}
INFO("Removed interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment