From 03645f0c270161dfb7f7d859ad03eedb94584599 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 2 Feb 2023 07:23:13 -0800 Subject: [PATCH] net/{netns,netstat}: use new x/sys/cpu.IsBigEndian See golang/go#57237 Change-Id: If47ab6de7c1610998a5808e945c4177c561eab45 Signed-off-by: Brad Fitzpatrick --- cmd/derper/depaware.txt | 2 +- cmd/tailscale/depaware.txt | 2 +- cmd/tailscaled/depaware.txt | 2 +- go.mod | 4 ++-- go.sum | 7 ++++--- net/netns/netns_windows.go | 4 ++-- net/netstat/netstat_windows.go | 6 +++--- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cmd/derper/depaware.txt b/cmd/derper/depaware.txt index 90fad07c5..529494f56 100644 --- a/cmd/derper/depaware.txt +++ b/cmd/derper/depaware.txt @@ -11,7 +11,7 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa github.com/fxamacker/cbor/v2 from tailscale.com/tka github.com/golang/groupcache/lru from tailscale.com/net/dnscache github.com/hdevalence/ed25519consensus from tailscale.com/tka - LW github.com/josharian/native from github.com/mdlayher/netlink+ + L github.com/josharian/native from github.com/mdlayher/netlink+ L 💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/interfaces L github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink github.com/klauspost/compress/flate from nhooyr.io/websocket diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index 16267ee59..181809ac7 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -12,7 +12,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep github.com/golang/groupcache/lru from tailscale.com/net/dnscache github.com/google/uuid from tailscale.com/util/quarantine+ github.com/hdevalence/ed25519consensus from tailscale.com/tka - LW github.com/josharian/native from github.com/mdlayher/netlink+ + L github.com/josharian/native from github.com/mdlayher/netlink+ L 💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/interfaces L github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink github.com/kballard/go-shellquote from tailscale.com/cmd/tailscale/cli diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 63ddd94ab..fa204f36f 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -86,7 +86,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de L github.com/insomniacslk/dhcp/interfaces from github.com/insomniacslk/dhcp/dhcpv4 L github.com/insomniacslk/dhcp/rfc1035label from github.com/insomniacslk/dhcp/dhcpv4 L github.com/jmespath/go-jmespath from github.com/aws/aws-sdk-go-v2/service/ssm - LW github.com/josharian/native from github.com/mdlayher/netlink+ + L github.com/josharian/native from github.com/mdlayher/netlink+ L 💣 github.com/jsimonetti/rtnetlink from tailscale.com/net/interfaces+ L github.com/jsimonetti/rtnetlink/internal/unix from github.com/jsimonetti/rtnetlink github.com/klauspost/compress from github.com/klauspost/compress/zstd diff --git a/go.mod b/go.mod index 51cf341de..a6f2e9517 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/iancoleman/strcase v0.2.0 github.com/illarion/gonotify v1.0.1 github.com/insomniacslk/dhcp v0.0.0-20221215072855-de60144f33f8 - github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531 + github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86 github.com/jsimonetti/rtnetlink v1.1.2-0.20220408201609-d380b505068b github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 github.com/klauspost/compress v1.15.4 @@ -74,7 +74,7 @@ require ( golang.org/x/net v0.5.0 golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 golang.org/x/sync v0.1.0 - golang.org/x/sys v0.4.0 + golang.org/x/sys v0.4.1-0.20230131160137-e7d7f63158de golang.org/x/term v0.4.0 golang.org/x/time v0.0.0-20220609170525-579cf78fd858 golang.org/x/tools v0.4.1-0.20221208213631-3f74d914ae6d diff --git a/go.sum b/go.sum index 9b9d1a44b..b386a7f34 100644 --- a/go.sum +++ b/go.sum @@ -696,8 +696,9 @@ github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUB github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/native v1.0.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= -github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531 h1:3HNVAxEgGca1i23Ai/8DeCmibx02jBvTHAT11INaVfU= github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= +github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86 h1:elKwZS1OcdQ0WwEDBeqxKwb7WB62QX8bvZ/FJnVXIfk= +github.com/josharian/native v1.1.1-0.20230202152459-5c7d0dd6ab86/go.mod h1:aFAMtuldEgx/4q7iSGazk22+IcgvtiC+HIimFO9XlS8= github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw= @@ -1583,8 +1584,8 @@ golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.1-0.20230131160137-e7d7f63158de h1:VO/n/VqVQnSnxYKbExOquQRm9FLLepZKkpYyXf1+6l8= +golang.org/x/sys v0.4.1-0.20230131160137-e7d7f63158de/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/net/netns/netns_windows.go b/net/netns/netns_windows.go index 9b66935ff..147a762ec 100644 --- a/net/netns/netns_windows.go +++ b/net/netns/netns_windows.go @@ -8,7 +8,7 @@ "strings" "syscall" - "github.com/josharian/native" + "golang.org/x/sys/cpu" "golang.org/x/sys/windows" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" "tailscale.com/net/interfaces" @@ -118,7 +118,7 @@ func bindSocket6(c syscall.RawConn, ifidx uint32) error { // representation, suitable for passing to Windows APIs that require a // mangled uint32. func nativeToBigEndian(i uint32) uint32 { - if native.IsBigEndian { + if cpu.IsBigEndian { return i } return bits.ReverseBytes32(i) diff --git a/net/netstat/netstat_windows.go b/net/netstat/netstat_windows.go index 8e39164e4..852e2c57e 100644 --- a/net/netstat/netstat_windows.go +++ b/net/netstat/netstat_windows.go @@ -11,7 +11,7 @@ "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)