net/{netns,netstat}: use new x/sys/cpu.IsBigEndian

See golang/go#57237

Change-Id: If47ab6de7c1610998a5808e945c4177c561eab45
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-02-02 07:23:13 -08:00
committed by Brad Fitzpatrick
parent 2755f3843c
commit 03645f0c27
7 changed files with 14 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ import (
"net/netip"
"unsafe"
"github.com/josharian/native"
"golang.org/x/sys/cpu"
"golang.org/x/sys/windows"
"tailscale.com/net/netaddr"
)
@@ -202,7 +202,7 @@ func state(v uint32) string {
}
func ipport4(addr uint32, port uint16) netip.AddrPort {
if !native.IsBigEndian {
if !cpu.IsBigEndian {
addr = bits.ReverseBytes32(addr)
}
return netip.AddrPortFrom(
@@ -220,7 +220,7 @@ func ipport6(addr [16]byte, scope uint32, port uint16) netip.AddrPort {
}
func port(v *uint32) uint16 {
if !native.IsBigEndian {
if !cpu.IsBigEndian {
return uint16(bits.ReverseBytes32(*v) >> 16)
}
return uint16(*v >> 16)