Skip to content

Commit

Permalink
Fix multiple DNS servers configured for network instance
Browse files Browse the repository at this point in the history
Multiple DNS servers (to advertize) should be configured for dnsmasq
as a one-line "dns-server" DHCP option, with comma-separated DNS server
IP addresses. Puting DNS servers each on a separate line is not correct,
dnsmasq will only advertize the last entry.

Signed-off-by: Milan Lenco <milan@zededa.com>
(cherry picked from commit 2734d55)
  • Loading branch information
milan-zededa authored and eriknordmark committed Apr 22, 2022
1 parent 352534a commit e98dd85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/pillar/cmd/zedrouter/dnsmasq.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,14 @@ func createDnsmasqConfiglet(
}
}
advertizeDns := false
for _, ns := range netstatus.DnsServers {
if len(netstatus.DnsServers) > 0 {
advertizeDns = true
var addrList []string
for _, srvIP := range netstatus.DnsServers {
addrList = append(addrList, srvIP.String())
}
file.WriteString(fmt.Sprintf("dhcp-option=option:dns-server,%s\n",
ns.String()))
strings.Join(addrList, ",")))
}
if netstatus.NtpServer != nil {
file.WriteString(fmt.Sprintf("dhcp-option=option:ntp-server,%s\n",
Expand Down

0 comments on commit e98dd85

Please sign in to comment.