[PATCH 1/5] bridge_driver: Set @dnsmasqStarted only after successful dnsmasq spawn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The networkStartNetworkVirtual() function handles starting of
networks of different forward types (none, nat, route, open).
And as a part of startup process dnsmasq might be spawned but
doesn't have to be (depending on the network configuration). The
@dnsmasqStarted variable is supposed to track whether dnsmasq was
started or not (so that it can be killed when starting network
fails after it was started). But the variable is set even when
the code decided not to start it.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 11696a9459..7ad9f278a2 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2052,11 +2052,12 @@ networkStartNetworkVirtual(virNetworkDriverState *driver,
 
 
     /* start dnsmasq if there are any IP addresses (v4 or v6) */
-    if ((v4present || v6present) &&
-        networkStartDhcpDaemon(driver, obj) < 0)
-        goto error;
+    if (v4present || v6present) {
+        if (networkStartDhcpDaemon(driver, obj) < 0)
+            goto error;
 
-    dnsmasqStarted = true;
+        dnsmasqStarted = true;
+    }
 
     if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0)
         goto error;
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux