From 930a5ad439e0f375e1efc8083e6fa28c5571fee6 Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Wed, 1 Mar 2023 09:02:10 +0700 Subject: [PATCH] cmd/ctrld: only set ::1 as DNS server on Windows if ipv6 available --- cmd/ctrld/os_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ctrld/os_windows.go b/cmd/ctrld/os_windows.go index 0bd7358..8858027 100644 --- a/cmd/ctrld/os_windows.go +++ b/cmd/ctrld/os_windows.go @@ -52,7 +52,7 @@ func setPrimaryDNS(iface *net.Interface, dns string) error { mainLog.Error().Err(err).Msgf("failed to set primary DNS: %s", string(output)) return err } - if ipVer == "ipv4" { + if ipVer == "ipv4" && ctrldnet.SupportsIPv6ListenLocal() { // Disable IPv6 DNS, so the query will be fallback to IPv4. _, _ = netsh("interface", "ipv6", "set", "dnsserver", idx, "static", "::1", "primary") }