The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3809
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Fixes #3757
From 0073b724e2fe383e4bec029ad3d847e1ee136921 Mon Sep 17 00:00:00 2001 From: Alberto Donato <[email protected]> Date: Mon, 18 Sep 2017 09:50:14 +0200 Subject: [PATCH] network: only add --quiet-* options to dnsmasq if version supports them Signed-off-by: Alberto Donato <[email protected]> --- lxd/networks.go | 11 ++++++++++- lxd/networks_utils.go | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lxd/networks.go b/lxd/networks.go index 939869556..353999bda 100644 --- a/lxd/networks.go +++ b/lxd/networks.go @@ -12,6 +12,7 @@ import ( "strconv" "strings" + "github.com/blang/semver" "github.com/gorilla/mux" log "gopkg.in/inconshreveable/log15.v2" @@ -778,7 +779,15 @@ func (n *network) Start() error { fmt.Sprintf("--interface=%s", n.name)} if !debug { - dnsmasqCmd = append(dnsmasqCmd, []string{"--quiet-dhcp", "--quiet-dhcp6", "--quiet-ra"}...) + // --quiet options are only supported on >2.67 + version, err := networkGetDnsmasqVersion() + if err != nil { + return err + } + minVer, _ := semver.ParseTolerant("2.67") + if version.GT(minVer) { + dnsmasqCmd = append(dnsmasqCmd, []string{"--quiet-dhcp", "--quiet-dhcp6", "--quiet-ra"}...) + } } // Configure IPv4 diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go index 37ab63d83..83c000bbe 100644 --- a/lxd/networks_utils.go +++ b/lxd/networks_utils.go @@ -20,6 +20,8 @@ import ( "syscall" "time" + "github.com/blang/semver" + "github.com/lxc/lxd/lxd/db" "github.com/lxc/lxd/lxd/state" "github.com/lxc/lxd/shared" @@ -727,6 +729,16 @@ func networkKillDnsmasq(name string, reload bool) error { return nil } +func networkGetDnsmasqVersion() (*semver.Version, error) { + output, err := shared.TryRunCommand("dnsmasq", "--version") + if err != nil { + return nil, fmt.Errorf("Failed to check dnsmasq version") + } + lines := strings.Split(output, " ") + version, err := semver.ParseTolerant(lines[2]) + return &version, err +} + func networkUpdateStatic(s *state.State, networkName string) error { // We don't want to race with ourselves here networkStaticLock.Lock()
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
