wgengine/netstack: fake pings through netstack on Android too

Every OS ping binary is slightly different. Adjust for Android's.

Updates #1738

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2022-01-07 09:52:54 -08:00 committed by Brad Fitzpatrick
parent 138662e248
commit 1a4e8da084
1 changed files with 6 additions and 0 deletions

View File

@ -419,6 +419,12 @@ func (ns *Impl) userPing(dstIP netaddr.IP, pingResPkt []byte) {
switch runtime.GOOS {
case "windows":
err = exec.Command("ping", "-n", "1", "-w", "3000", dstIP.String()).Run()
case "android":
ping := "/system/bin/ping"
if dstIP.Is6() {
ping = "/system/bin/ping6"
}
err = exec.Command(ping, "-c", "1", "-w", "3", dstIP.String()).Run()
default:
err = exec.Command("ping", "-c", "1", "-W", "3", dstIP.String()).Run()
}