From c253d4f9486000395a80bf00a130ecc16c7232a8 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 31 Jul 2020 10:35:15 -0700 Subject: [PATCH] net/interfaces: don't try to fork on iOS in likelyHomeRouterIPDarwin No subprocesses allowed on iOS. Will need to do this differently later. --- net/interfaces/interfaces_darwin.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/interfaces/interfaces_darwin.go b/net/interfaces/interfaces_darwin.go index 75bd1700c..0b9870a74 100644 --- a/net/interfaces/interfaces_darwin.go +++ b/net/interfaces/interfaces_darwin.go @@ -10,6 +10,7 @@ import ( "go4.org/mem" "inet.af/netaddr" "tailscale.com/util/lineread" + "tailscale.com/version" ) func init() { @@ -32,6 +33,13 @@ default link#14 UCSI utun2 */ func likelyHomeRouterIPDarwin() (ret netaddr.IP, ok bool) { + if version.IsMobile() { + // Don't try to do subprocesses on iOS. Ends up with log spam like: + // kernel: "Sandbox: IPNExtension(86580) deny(1) process-fork" + // TODO(bradfitz): let our iOS app register a func with this package + // and have it call into C/Swift to get the routing table. + return ret, false + } cmd := exec.Command("/usr/sbin/netstat", "-r", "-n", "-f", "inet") stdout, err := cmd.StdoutPipe() if err != nil {