Skip to content

Commit b75cc38

Browse files
committed
conf: do not examine connectivity state at boot
It turns out that checking for internet connectivity is not really a reliable way of knowing whether the WSAHOST_NOT_FOUND is legitimate or not. So just give up on that approach, assume WSAHOST_NOT_FOUND is always illegitimate at boot, and loop for a long time. This might induce annoyances for admins who want to kill legitimate WSAHOST_NOT_FOUND services that keep trying again, but they'll just have to wait for two minutes. Reported-by: Simon Rozman <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 6ed37f3 commit b75cc38

File tree

3 files changed

+4
-65
lines changed

3 files changed

+4
-65
lines changed

conf/dnsresolver_windows.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ import (
1717
"golang.zx2c4.com/wireguard/windows/services"
1818
)
1919

20-
//sys internetGetConnectedState(flags *uint32, reserved uint32) (connected bool) = wininet.InternetGetConnectedState
21-
2220
func resolveHostname(name string) (resolvedIPString string, err error) {
2321
maxTries := 10
2422
if services.StartedAtBoot() {
25-
maxTries *= 4
23+
maxTries *= 3
2624
}
2725
for i := 0; i < maxTries; i++ {
2826
if i > 0 {
@@ -33,12 +31,11 @@ func resolveHostname(name string) (resolvedIPString string, err error) {
3331
return
3432
}
3533
if err == windows.WSATRY_AGAIN {
36-
log.Printf("Temporary DNS error when resolving %s, sleeping for 4 seconds", name)
34+
log.Printf("Temporary DNS error when resolving %s, so sleeping for 4 seconds", name)
3735
continue
3836
}
39-
var state uint32
40-
if err == windows.WSAHOST_NOT_FOUND && services.StartedAtBoot() && !internetGetConnectedState(&state, 0) {
41-
log.Printf("Host not found when resolving %s, but no Internet connection available, sleeping for 4 seconds", name)
37+
if err == windows.WSAHOST_NOT_FOUND && services.StartedAtBoot() {
38+
log.Printf("Host not found when resolving %s at boot time, so sleeping for 4 seconds", name)
4239
continue
4340
}
4441
return

conf/mksyscall.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

conf/zsyscall_windows.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)