mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 23:37:42 +00:00
bridge_driver: Don't define network if XML contains more IPv4 adreses.
Only one IPv4 DHCP definition is supported. Originally the code checked for a multiple definition and returned an error, but the new domain definition was already added to networks. This patch moves the check before the newly defined network is added to active networks. *src/network/bridge_driver.c: networkDefine(): - move multiple IPv4 addresses check before definition is used.
This commit is contained in:
parent
764574f7c7
commit
0763a26dfe
@ -2278,19 +2278,6 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
|
||||
virNetworkSetBridgeMacAddr(def);
|
||||
}
|
||||
|
||||
if (!(network = virNetworkAssignDef(&driver->networks,
|
||||
def)))
|
||||
goto cleanup;
|
||||
freeDef = false;
|
||||
|
||||
network->persistent = 1;
|
||||
|
||||
if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
|
||||
virNetworkRemoveInactive(&driver->networks, network);
|
||||
network = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* We only support dhcp on one IPv4 address per defined network */
|
||||
for (ii = 0;
|
||||
(ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, ii));
|
||||
@ -2307,6 +2294,20 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(network = virNetworkAssignDef(&driver->networks,
|
||||
def)))
|
||||
goto cleanup;
|
||||
freeDef = false;
|
||||
|
||||
network->persistent = 1;
|
||||
|
||||
if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
|
||||
virNetworkRemoveInactive(&driver->networks, network);
|
||||
network = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (ipv4def) {
|
||||
dctx = dnsmasqContextNew(def->name, DNSMASQ_STATE_DIR);
|
||||
if (dctx == NULL ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user