From 84dc367e2a6febfcc4aeea4c52e44c52aea298fc Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Mon, 14 Dec 2020 16:19:26 -0500 Subject: [PATCH] lxc: don't try to reserve macvtap name for LXC domains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 729a06c41 added code to the LXC driver (patterned after similar code in the QEMU driver) that called virNetDevMacVlanReserveName(net->ifname) for all type='direct' interfaces during a libvirtd restart, to prevent other domains from attempting to use a macvtap device name that was already in use by a domain. But, unlike a QEMU domain, when an LXC domain creates a macvtap device, that device is almost immediately moved into the namespace of the container (and it's then renamed, but that part isn't important). Because of this, the LXC driver doesn't keep track (in net->ifname) of the name used to create the device (as the QEMU driver does). The result of this is that if libvirtd is restarted while there is an active LXC domain that has , libvirtd will segfault (since virNetDevMacVLanReserveName() doesn't check for a NULL pointer). The fix is to just not call that function in the case of the LXC driver, since it is pointless anyway. Fixes: 729a06c41afaab419a70841b6749646e2f8fad1d Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrangé --- src/lxc/lxc_process.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 937e9a3fc1..42ff4531a8 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1636,13 +1636,6 @@ virLXCProcessReconnectNotifyNets(virDomainDefPtr def) for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; - /* keep others from trying to use the macvtap device name, but - * don't return error if this happens, since that causes the - * domain to be unceremoniously killed, which would be *very* - * impolite. - */ - if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) - virNetDevMacVLanReserveName(net->ifname); if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { if (!conn && !(conn = virGetConnectNetwork()))