[libvirt] PATCH: Always start dnsmasq to provide DNS

Daniel P. Berrange berrange at redhat.com
Thu Jul 30 13:57:59 UTC 2009


Currently we only start dnsmasq if DHCP ranges are configured.

https://bugzilla.redhat.com/show_bug.cgi?id=508965

points out that this prevents use of DNS in guests using static IP config.

Thus this patch makes us always start dnsmasq, regardless of DHCP config
if we have an IP addr configured.

There is no need for the --no-dhcp-interface= that BZ mentions, since
that's just to allow you to restrict which interfaces dnsmasq does
DHCP on - we've already restricted it to just out interface, and
leaving out the DHCP ranges disables its DHCP server for every
interface

Regards,
Daniel

commit deb71927a3551b3a1554351ef098644aec978a09
Author: Daniel P. Berrange <berrange at redhat.com>
Date:   Thu Jul 30 14:52:31 2009 +0100

    Allow dnsmasq to provide DNS without DHCP
    
    * src/network_driver.c: Always start dnsmasq to allow it to provide
      DNS, even if no DHCP ranges are enabled

diff --git a/src/network_driver.c b/src/network_driver.c
index 9621782..1683631 100644
--- a/src/network_driver.c
+++ b/src/network_driver.c
@@ -136,8 +136,9 @@ networkFindActiveConfigs(struct network_driver *driver) {
             brHasBridge(driver->brctl, obj->def->bridge) == 0) {
             obj->active = 1;
 
-            /* Finally try and read dnsmasq pid if any DHCP ranges are set */
-            if (obj->def->nranges &&
+            /* Finally try and read dnsmasq pid if any */
+            if ((obj->def->ipAddress ||
+                 obj->def->nranges) &&
                 virFileReadPid(NETWORK_PID_DIR, obj->def->name,
                                &obj->dnsmasqPid) == 0) {
 
@@ -844,7 +845,8 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
         goto err_delbr2;
     }
 
-    if (network->def->nranges &&
+    if ((network->def->ipAddress ||
+         network->def->nranges) &&
         dhcpStartDhcpDaemon(conn, network) < 0)
         goto err_delbr2;
 


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list