mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
wgengine/netstack: use ping6 on BSD platforms
Various BSD-derived operating systems including macOS and FreeBSD require that ping6 be used for IPv6 destinations. The "ping" command does not understand an IPv6 destination. FreeBSD 13.x and later do handle IPv6 in the regular ping command, but also retain a ping6 command. We use ping6 on all versions of FreeBSD. Fixes https://github.com/tailscale/tailscale/issues/8225 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:
parent
c0b4a54146
commit
399a80785e
@ -622,11 +622,21 @@ func (ns *Impl) userPing(dstIP netip.Addr, pingResPkt []byte) {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
err = exec.Command("ping", "-n", "1", "-w", "3000", dstIP.String()).Run()
|
||||
case "darwin":
|
||||
case "darwin", "freebsd":
|
||||
// Note: 2000 ms is actually 1 second + 2,000
|
||||
// milliseconds extra for 3 seconds total.
|
||||
// See https://github.com/tailscale/tailscale/pull/3753 for details.
|
||||
err = exec.Command("ping", "-c", "1", "-W", "2000", dstIP.String()).Run()
|
||||
ping := "ping"
|
||||
if dstIP.Is6() {
|
||||
ping = "ping6"
|
||||
}
|
||||
err = exec.Command(ping, "-c", "1", "-W", "2000", dstIP.String()).Run()
|
||||
case "openbsd":
|
||||
ping := "ping"
|
||||
if dstIP.Is6() {
|
||||
ping = "ping6"
|
||||
}
|
||||
err = exec.Command(ping, "-c", "1", "-w", "3", dstIP.String()).Run()
|
||||
case "android":
|
||||
ping := "/system/bin/ping"
|
||||
if dstIP.Is6() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user