mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
network: check newDef for used bridge names in addition to def
If someone has updated a network to change its bridge name, but the network is still active (so that bridge name hasn't taken effect yet), we still want to disallow another network from taking that new name.
This commit is contained in:
parent
37b8bc6f12
commit
06313277f2
@ -3270,15 +3270,22 @@ virNetworkBridgeInUseHelper(const void *payload,
|
||||
const void *name ATTRIBUTE_UNUSED,
|
||||
const void *opaque)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
virNetworkObjPtr net = (virNetworkObjPtr) payload;
|
||||
const struct virNetworkBridgeInUseHelperData *data = opaque;
|
||||
|
||||
virObjectLock(net);
|
||||
if (net->def->bridge &&
|
||||
STREQ(net->def->bridge, data->bridge) &&
|
||||
!(data->skipname && STREQ(net->def->name, data->skipname)))
|
||||
if (data->skipname &&
|
||||
((net->def && STREQ(net->def->name, data->skipname)) ||
|
||||
(net->newDef && STREQ(net->newDef->name, data->skipname))))
|
||||
ret = 0;
|
||||
else if ((net->def && net->def->bridge &&
|
||||
STREQ(net->def->bridge, data->bridge)) ||
|
||||
(net->newDef && net->newDef->bridge &&
|
||||
STREQ(net->newDef->bridge, data->bridge)))
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
virObjectUnlock(net);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user