Some people want to define a libvirt network but have dns served by another daemon. Libvirt used to support that, but hasn't for several years. Two long-open bugs on this are https://bugzilla.redhat.com/show_bug.cgi?id=636115 https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/584862 I'm not certain whether we really want to support this, as another option is to simply create the bridge with external tools and tell libvirt vms to use that bridge. However, if we do want to support it, this patch provides that support. This patch allows an admin to set <nodnsmasq>true</nodnsmasq> in a bridge definition to avoid having libvirt start a dnsmasq. Signed-off-by: Serge Hallyn <serge.hallyn@xxxxxxxxxx> --- src/conf/network_conf.c | 15 +++++++++++++++ src/conf/network_conf.h | 1 + src/network/bridge_driver.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) Index: libvirt-1.2.16/src/conf/network_conf.c =================================================================== --- libvirt-1.2.16.orig/src/conf/network_conf.c +++ libvirt-1.2.16/src/conf/network_conf.c @@ -1985,6 +1985,7 @@ virNetworkDefParseXML(xmlXPathContextPtr xmlNodePtr virtPortNode = NULL; xmlNodePtr forwardNode = NULL; char *ipv6nogwStr = NULL; + char *noDnsmasqStr = NULL; char *trustGuestRxFilters = NULL; xmlNodePtr save = ctxt->node; xmlNodePtr bandwidthNode = NULL; @@ -2018,6 +2019,20 @@ virNetworkDefParseXML(xmlXPathContextPtr def->uuid_specified = true; } + /* check if user requested no dnsmasq */ + noDnsmasqStr = virXPathString("string(./nodnsmasq[1])", ctxt); + if (noDnsmasqStr) { + if (STREQ(noDnsmasqStr, "yes") || STREQ(noDnsmasqStr, "true")) { + def->nodnsmasq = true; + } else if (STRNEQ(noDnsmasqStr, "no") && STRNEQ(noDnsmasqStr, "false")) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid nodnsmasq setting '%s' in network '%s'"), + noDnsmasqStr, def->name); + goto error; + } + VIR_FREE(noDnsmasqStr); + } + /* check if definitions with no IPv6 gateway addresses is to * allow guest-to-guest communications. */ @@ -2660,6 +2675,9 @@ virNetworkDefFormatBuf(virBufferPtr buf, virUUIDFormat(uuid, uuidstr); virBufferAsprintf(buf, "<uuid>%s</uuid>\n", uuidstr); + if (def->nodnsmasq) + virBufferAsprintf(buf, "<nodnsmasq>true</nodnsmasq>\n"); + if (def->forward.type != VIR_NETWORK_FORWARD_NONE) { const char *dev = NULL; if (!def->forward.npfs) Index: libvirt-1.2.16/src/conf/network_conf.h =================================================================== --- libvirt-1.2.16.orig/src/conf/network_conf.h +++ libvirt-1.2.16/src/conf/network_conf.h @@ -231,6 +231,7 @@ struct _virNetworkDef { bool stp; /* Spanning tree protocol */ virMacAddr mac; /* mac address of bridge device */ bool mac_specified; + bool nodnsmasq; /* specified if ip6tables rules added * when no ipv6 gateway addresses specified. Index: libvirt-1.2.16/src/network/bridge_driver.c =================================================================== --- libvirt-1.2.16.orig/src/network/bridge_driver.c +++ libvirt-1.2.16/src/network/bridge_driver.c @@ -2146,7 +2146,7 @@ networkStartNetworkVirtual(virNetworkDri /* start dnsmasq if there are any IP addresses (v4 or v6) */ - if ((v4present || v6present) && + if ((v4present || v6present) && !network->def->nodnsmasq && networkStartDhcpDaemon(driver, network) < 0) goto err3; -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list