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) ...@@ -2574,17 +2574,16 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
* interface to the network namespace, we have to destroy it. * interface to the network namespace, we have to destroy it.
*/ */
ret = lxc_netdev_delete_by_index(netdev->ifindex); ret = lxc_netdev_delete_by_index(netdev->ifindex);
if (-ret == ENODEV) { if (ret < 0) {
INFO("Interface \"%s\" with index %d already " if (errno != ENODEV) {
"deleted or existing in different network " WARN("Failed to remove interface \"%s\" with index %d",
"namespace", netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->name[0] != '\0' ? netdev->name : "(null)", netdev->ifindex);
netdev->ifindex); goto clear_ifindices;
} else if (ret < 0) { }
WARN("Failed to remove interface \"%s\" with index %d", INFO("Interface \"%s\" with index %d already deleted or existing in different network namespace",
netdev->name[0] != '\0' ? netdev->name : "(null)", netdev->name[0] != '\0' ? netdev->name : "(null)",
netdev->ifindex); netdev->ifindex);
goto clear_ifindices;
} }
INFO("Removed interface \"%s\" with index %d", INFO("Removed interface \"%s\" with index %d",
netdev->name[0] != '\0' ? netdev->name : "(null)", 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