net/interfaces: log why when we failed to look up gateway on macOS

Not beautiful, but I'm debugging connectivity problems on
NEProvider.sleep+wake and need more clues.

Updates #1426
Updates tailscale/corp#1289

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2021-03-05 09:43:38 -08:00
parent affd859121
commit b14ea68754

View File

@ -105,6 +105,7 @@ import "C"
import (
"encoding/binary"
"log"
"inet.af/netaddr"
)
@ -116,6 +117,7 @@ func init() {
func likelyHomeRouterIPDarwinSyscall() (ret netaddr.IP, ok bool) {
ip := C.privateGatewayIP()
if ip < 255 {
log.Printf("likelyHomeRouterIPDarwinSyscall: error code %v", ip)
return netaddr.IP{}, false
}
var q [4]byte