net/dns: fix darwin dns resolver files

putting each nameserver on one line in /etc/resolver/<domain>

fixes: #10134
Signed-off-by: Juergen Knaack <jk@jk-1.de>
pull/10433/head
Juergen Knaack 1 year ago committed by Denton Gentry
parent cbd0b60743
commit c27aa9e7ff

@ -36,15 +36,11 @@ func (c *darwinConfigurator) SupportsSplitDNS() bool {
func (c *darwinConfigurator) SetDNS(cfg OSConfig) error {
var buf bytes.Buffer
buf.WriteString(macResolverFileHeader)
for i, ip := range cfg.Nameservers {
if i == 0 {
buf.WriteString("nameserver ")
} else {
buf.WriteString(" ")
}
for _, ip := range cfg.Nameservers {
buf.WriteString("nameserver ")
buf.WriteString(ip.String())
buf.WriteString("\n")
}
buf.WriteString("\n")
if err := os.MkdirAll("/etc/resolver", 0755); err != nil {
return err

Loading…
Cancel
Save