mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-16 09:35:16 +00:00
selinux: relabel tapfd in qemuPhysIfaceConnect
Relabeling tapfd right after the tap device is created. qemuPhysIfaceConnect is common function called both for static netdevs and for hotplug netdevs. (cherry picked from commit 4492ef7f485a7d42d84a714d2150e648b11e2740)
This commit is contained in:
parent
ec08a738e8
commit
cefa64cafd
@ -170,12 +170,26 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
|
|||||||
vmop, driver->stateDir,
|
vmop, driver->stateDir,
|
||||||
virDomainNetGetActualBandwidth(net));
|
virDomainNetGetActualBandwidth(net));
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
|
if (virSecurityManagerSetTapFDLabel(driver->securityManager,
|
||||||
|
def, rc) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
virDomainAuditNetDevice(def, net, res_ifname, true);
|
virDomainAuditNetDevice(def, net, res_ifname, true);
|
||||||
VIR_FREE(net->ifname);
|
VIR_FREE(net->ifname);
|
||||||
net->ifname = res_ifname;
|
net->ifname = res_ifname;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
error:
|
||||||
|
ignore_value(virNetDevMacVLanDeleteWithVPortProfile(
|
||||||
|
res_ifname, &net->mac,
|
||||||
|
virDomainNetGetActualDirectDev(net),
|
||||||
|
virDomainNetGetActualDirectMode(net),
|
||||||
|
virDomainNetGetActualVirtPortProfile(net),
|
||||||
|
driver->stateDir));
|
||||||
|
VIR_FREE(res_ifname);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5474,10 +5488,6 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
if (tapfd < 0)
|
if (tapfd < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (virSecurityManagerSetTapFDLabel(driver->securityManager,
|
|
||||||
def, tapfd) < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
last_good_net = i;
|
last_good_net = i;
|
||||||
virCommandTransferFD(cmd, tapfd);
|
virCommandTransferFD(cmd, tapfd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user