1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

networkStartNetworkVirtual: Dissolve 'err4' label in 'error'

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2019-04-23 16:44:59 +02:00
parent 9e3356ea1e
commit 12288fae6b

View File

@ -2335,7 +2335,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
virMacMapPtr macmap; virMacMapPtr macmap;
char *macMapFile = NULL; char *macMapFile = NULL;
int tapfd = -1; int tapfd = -1;
pid_t dnsmasqPid; bool dnsmasqStarted = false;
/* Check to see if any network IP collides with an existing route */ /* Check to see if any network IP collides with an existing route */
if (networkCheckRouteCollision(def) < 0) if (networkCheckRouteCollision(def) < 0)
@ -2465,22 +2465,24 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
networkStartDhcpDaemon(driver, obj) < 0) networkStartDhcpDaemon(driver, obj) < 0)
goto err3; goto err3;
dnsmasqStarted = true;
/* start radvd if there are any ipv6 addresses */ /* start radvd if there are any ipv6 addresses */
if (v6present && networkStartRadvd(driver, obj) < 0) if (v6present && networkStartRadvd(driver, obj) < 0)
goto err4; goto error;
/* dnsmasq does not wait for DAD to complete before daemonizing, /* dnsmasq does not wait for DAD to complete before daemonizing,
* so we need to wait for it ourselves. * so we need to wait for it ourselves.
*/ */
if (v6present && networkWaitDadFinish(obj) < 0) if (v6present && networkWaitDadFinish(obj) < 0)
goto err4; goto error;
/* DAD has finished, dnsmasq is now bound to the /* DAD has finished, dnsmasq is now bound to the
* bridge's IPv6 address, so we can set the dummy tun down. * bridge's IPv6 address, so we can set the dummy tun down.
*/ */
if (tapfd >= 0) { if (tapfd >= 0) {
if (virNetDevSetOnline(macTapIfName, false) < 0) if (virNetDevSetOnline(macTapIfName, false) < 0)
goto err4; goto error;
VIR_FORCE_CLOSE(tapfd); VIR_FORCE_CLOSE(tapfd);
} }
@ -2497,12 +2499,8 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
if (def->bandwidth) if (def->bandwidth)
virNetDevBandwidthClear(def->bridge); virNetDevBandwidthClear(def->bridge);
err4: if (dnsmasqStarted) {
if (!save_err) pid_t dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
virErrorPreserveLast(&save_err);
dnsmasqPid = virNetworkObjGetDnsmasqPid(obj);
if (dnsmasqPid > 0) {
kill(dnsmasqPid, SIGTERM); kill(dnsmasqPid, SIGTERM);
virNetworkObjSetDnsmasqPid(obj, -1); virNetworkObjSetDnsmasqPid(obj, -1);
} }