[lxc-devel] [lxd/master] network: Always pass --conf-file to dnsmasq

stgraber on Github lxc-bot at linuxcontainers.org
Wed May 31 16:18:40 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170531/ac7dd835/attachment.bin>
-------------- next part --------------
From d746deddb52a5419bf03b283878f94cbeec4cc08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 31 May 2017 12:18:01 -0400
Subject: [PATCH] network: Always pass --conf-file to dnsmasq
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #3367

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/networks.go | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lxd/networks.go b/lxd/networks.go
index f5582127b..7a8be9c9f 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -1156,14 +1156,12 @@ func (n *network) Start() error {
 			dnsmasqCmd = append(dnsmasqCmd, []string{"-s", dnsDomain, "-S", fmt.Sprintf("/%s/", dnsDomain)}...)
 		}
 
-		// Create raw config file
-		if n.config["raw.dnsmasq"] != "" {
-			err = ioutil.WriteFile(shared.VarPath("networks", n.name, "dnsmasq.raw"), []byte(fmt.Sprintf("%s\n", n.config["raw.dnsmasq"])), 0)
-			if err != nil {
-				return err
-			}
-			dnsmasqCmd = append(dnsmasqCmd, fmt.Sprintf("--conf-file=%s", shared.VarPath("networks", n.name, "dnsmasq.raw")))
+		// Create a config file to contain additional config (and to prevent dnsmasq from reading /etc/dnsmasq.conf)
+		err = ioutil.WriteFile(shared.VarPath("networks", n.name, "dnsmasq.raw"), []byte(fmt.Sprintf("%s\n", n.config["raw.dnsmasq"])), 0)
+		if err != nil {
+			return err
 		}
+		dnsmasqCmd = append(dnsmasqCmd, fmt.Sprintf("--conf-file=%s", shared.VarPath("networks", n.name, "dnsmasq.raw")))
 
 		// Create DHCP hosts file
 		if !shared.PathExists(shared.VarPath("networks", n.name, "dnsmasq.hosts")) {


More information about the lxc-devel mailing list