]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lxc: don't try to reserve macvtap name for LXC domains
authorLaine Stump <laine@redhat.com>
Mon, 14 Dec 2020 21:19:26 +0000 (16:19 -0500)
committerLaine Stump <laine@redhat.com>
Tue, 15 Dec 2020 14:27:55 +0000 (09:27 -0500)
commit84dc367e2a6febfcc4aeea4c52e44c52aea298fc
tree9af3a4d9f55add267a335a4113fc6ab47ecd94b2
parent555b880aae49480ec4e593f4146092b1e39b8299
lxc: don't try to reserve macvtap name for LXC domains

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 <interface type='direct'>, 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 <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/lxc/lxc_process.c