Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions client_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
package ethtool

import (
"encoding/binary"
"errors"
"fmt"
"os"
"slices"
"strings"

"github.com/josharian/native"
"github.com/mdlayher/genetlink"
"github.com/mdlayher/netlink"
"golang.org/x/sys/cpu"
"golang.org/x/sys/unix"
)

Expand Down Expand Up @@ -186,7 +185,7 @@ func (lmu *LinkModeUpdate) encode(ae *netlink.AttributeEncoder) {
nae.Uint32(unix.ETHTOOL_A_BITSET_SIZE, uint32(bitlen))
b := make([]byte, ((bitlen+31)/32)*4)
b = lmu.Advertise.FillBytes(b)
if binary.ByteOrder(native.Endian) == binary.LittleEndian {
if !cpu.IsBigEndian {
// FillBytes is big endian, reverse bytes for host order
slices.Reverse(b)
}
Expand Down
5 changes: 2 additions & 3 deletions client_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
package ethtool

import (
"encoding/binary"
"os"
"testing"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/josharian/native"
"github.com/mdlayher/genetlink"
"github.com/mdlayher/genetlink/genltest"
"github.com/mdlayher/netlink"
"golang.org/x/sys/cpu"
"golang.org/x/sys/unix"
)

Expand Down Expand Up @@ -1029,7 +1028,7 @@ func TestSetPrivateFlags(t *testing.T) {
func skipBigEndian(t *testing.T) {
t.Helper()

if binary.ByteOrder(native.Endian) == binary.BigEndian {
if cpu.IsBigEndian {
t.Skip("skipping, this test requires a little endian machine")
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.23.0

require (
github.com/google/go-cmp v0.7.0
github.com/josharian/native v1.1.0
github.com/mdlayher/genetlink v1.3.2
github.com/mdlayher/netlink v1.7.2
golang.org/x/sys v0.34.0
)

require (
github.com/josharian/native v1.1.0 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
Expand Down
Loading