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

[libvirt] PATCH: Always start dnsmasq to provide DNS

Currently we only start dnsmasq if DHCP ranges are configured.


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


commit deb71927a3551b3a1554351ef098644aec978a09
Author: Daniel P. Berrange <berrange 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 :|

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