mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
lxc: fix variable storage order before call
virDomainConfNWFilterInstantiate() was called without updated net->ifname, it caused in some cases throwing error message. If function failed, change is reverted. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/658 Signed-off-by: Adam Julis <ajulis@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
f2710260d4
commit
0fd36e9656
@ -271,6 +271,7 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm,
|
|||||||
{
|
{
|
||||||
g_autofree char *parentVeth = NULL;
|
g_autofree char *parentVeth = NULL;
|
||||||
g_autofree char *containerVeth = NULL;
|
g_autofree char *containerVeth = NULL;
|
||||||
|
g_autofree char *backupIfname = NULL;
|
||||||
const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
|
const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
|
||||||
|
|
||||||
VIR_DEBUG("calling vethCreate()");
|
VIR_DEBUG("calling vethCreate()");
|
||||||
@ -315,14 +316,17 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net->filter &&
|
/* success almost guaranteed, next function needs updated net->ifname */
|
||||||
virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0)
|
backupIfname = g_steal_pointer(&net->ifname);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* success is guaranteed, so update the interface object */
|
|
||||||
g_free(net->ifname);
|
|
||||||
net->ifname = g_steal_pointer(&parentVeth);
|
net->ifname = g_steal_pointer(&parentVeth);
|
||||||
|
|
||||||
|
if (net->filter &&
|
||||||
|
virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0) {
|
||||||
|
g_free(net->ifname);
|
||||||
|
net->ifname = g_steal_pointer(&backupIfname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return g_steal_pointer(&containerVeth);
|
return g_steal_pointer(&containerVeth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user