Skip to content

Commit

Permalink
network: fix {mac,ip,v}lan device creation
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed May 18, 2020
1 parent 717f77f commit 9f8cf6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lxc/network.c
Expand Up @@ -482,6 +482,8 @@ static int instantiate_macvlan(struct lxc_handler *handler, struct lxc_netdev *n
goto on_error;
}

strlcpy(netdev->created_name, peer, IFNAMSIZ);

netdev->ifindex = if_nametoindex(peer);
if (!netdev->ifindex) {
ERROR("Failed to retrieve ifindex for \"%s\"", peer);
Expand Down Expand Up @@ -3115,9 +3117,9 @@ int lxc_network_move_created_netdev_priv(struct lxc_handler *handler)
physname = is_wlan(netdev->link);

if (physname)
ret = lxc_netdev_move_wlan(physname, netdev->link, pid, netdev->name);
ret = lxc_netdev_move_wlan(physname, netdev->link, pid, NULL);
else
ret = lxc_netdev_move_by_index(netdev->ifindex, pid, netdev->name);
ret = lxc_netdev_move_by_index(netdev->ifindex, pid, NULL);
if (ret)
return log_error_errno(-1, -ret, "Failed to move network device \"%s\" with ifindex %d to network namespace %d",
netdev->created_name,
Expand Down

3 comments on commit 9f8cf6e

@tomponline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brauner thanks for this. What is the reason for the change in lxc_network_move_created_netdev_priv, it looks like that stops them being renamed?

@brauner
Copy link
Member

@brauner brauner commented on 9f8cf6e May 19, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomponline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brauner I see, thanks.

Please sign in to comment.