[lxc-devel] [lxc/master] network: fix {mac, ip, v}lan device creation

brauner on Github lxc-bot at linuxcontainers.org
Mon May 18 15:12:00 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200518/f1b676a2/attachment.bin>
-------------- next part --------------
From 9f8cf6e1102562e20ece76fa7b656bff62d59038 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 18 May 2020 17:11:26 +0200
Subject: [PATCH] network: fix {mac,ip,v}lan device creation

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/network.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index ef6707ff4c..5845a5c13f 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -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);
@@ -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,


More information about the lxc-devel mailing list