[libvirt] [PATCH 07/10] network: Bridge - don't offer dnsmasq DHCP services when DHCP relay is enabled

TJ libvirt at iam.tj
Thu Feb 28 02:57:32 UTC 2013


From: TJ <linux at iam.tj>

When dnsmasq's DNS services are required but the network is configured
to use a DHCP relay agent (other than dnsmasq's proxy services) the
configuration generated for dnsmasq should not enable DHCP services.

Signed-off-by: TJ <linux at iam.tj>
---
 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 c02d3de..a4cd727 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -951,11 +951,12 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
 
     ipv4def = ipv6def = NULL;
     ipdef = network->def->ipv4_dhcp;
-    if (ipdef && (ipdef->nranges || ipdef->nhosts))
+    if (ipdef && ipdef->dhcp_enabled && !ipdef->dhcp_relay &&
+        (ipdef->nranges || ipdef->nhosts))
         ipv4def = ipdef;
 
     ipdef = network->def->ipv6_dhcp;
-    if (ipdef) {
+    if (ipdef && ipdef->dhcp_enabled && !ipdef->dhcp_relay) {
         if (ipdef->nranges || ipdef->nhosts) {
             ipv6def = ipdef;
 
@@ -1266,8 +1267,8 @@ static int
 networkRefreshDhcpDaemon(struct network_driver *driver,
                          virNetworkObjPtr network)
 {
-    int ret = -1, ii;
-    virNetworkIpDefPtr ipdef, ipv4def, ipv6def;
+    int ret = -1;
+    virNetworkIpDefPtr ipv4def, ipv6def;
     dnsmasqContext *dctx = NULL;
 
     /* if no IP addresses specified, nothing to do */
-- 
1.8.1.2.433.g9808ce0.dirty




More information about the libvir-list mailing list