mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
net/dns: always proxy through quad-100 on windows 8.1.
Windows 8.1 incorrectly handles search paths on an interface with no associated resolver, so we have to provide a full primary DNS config rather than use Windows 8.1's nascent-but-present NRPT functionality. Fixes #2237. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
45e64f2e1a
commit
084d48d22d
@ -44,7 +44,7 @@ func NewOSConfigurator(logf logger.Logf, interfaceName string) (OSConfigurator,
|
|||||||
ret := windowsManager{
|
ret := windowsManager{
|
||||||
logf: logf,
|
logf: logf,
|
||||||
guid: interfaceName,
|
guid: interfaceName,
|
||||||
nrptWorks: !isWindows7(),
|
nrptWorks: isWindows10OrBetter(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Best-effort: if our NRPT rule exists, try to delete it. Unlike
|
// Best-effort: if our NRPT rule exists, try to delete it. Unlike
|
||||||
@ -407,22 +407,16 @@ type candidate struct {
|
|||||||
netaddr.MustParseIP("fec0:0:0:ffff::3"),
|
netaddr.MustParseIP("fec0:0:0:ffff::3"),
|
||||||
}
|
}
|
||||||
|
|
||||||
func isWindows7() bool {
|
func isWindows10OrBetter() bool {
|
||||||
key, err := registry.OpenKey(registry.LOCAL_MACHINE, versionKey, registry.READ)
|
key, err := registry.OpenKey(registry.LOCAL_MACHINE, versionKey, registry.READ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Fail safe, assume Windows 7.
|
// Fail safe, assume old Windows.
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
ver, _, err := key.GetStringValue("CurrentVersion")
|
// This key above only exists in Windows 10 and above. Its mere
|
||||||
if err != nil {
|
// presence is good enough.
|
||||||
return true
|
if _, _, err := key.GetIntegerValue("CurrentMajorVersionNumber"); err != nil {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
// Careful to not assume anything about version numbers beyond
|
return true
|
||||||
// 6.3, Microsoft deprecated this registry key and locked its
|
|
||||||
// value to what it was in Windows 8.1. We can only use this to
|
|
||||||
// probe for versions before that. Good thing we only need Windows
|
|
||||||
// 7 (so far).
|
|
||||||
//
|
|
||||||
// And yes, Windows 7 is version 6.1. Don't ask.
|
|
||||||
return ver == "6.1"
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user