Skip to content

Commit afa2eb2

Browse files
tklauseraboch
authored andcommitted
Use IFLA_* consts defined in golang.org/x/sys/unix
Use the constants provided in the golang.org/x/sys/unix package instead of locally defining them, as done in commit c94808a ("link: add support for IFLA_GRO_MAX_SIZE"). Signed-off-by: Tobias Klauser <[email protected]>
1 parent 6e2993d commit afa2eb2

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ go 1.12
44

55
require (
66
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae
7-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1
7+
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418
88
)

go.sum

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae h1:4hwBBUfQCFe3Cym0ZtKyq7L16eZUtYKs+BaHDN6mAns=
22
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
3-
golang.org/x/sys v0.0.0-20200217220822-9197077df867 h1:JoRuNIf+rpHl+VhScRQQvzbHed86tKkqwPMV34T8myw=
43
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE=
6-
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
4+
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME=
5+
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

link_linux.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ func (h *Handle) LinkSetGROMaxSize(link Link, maxSize int) error {
993993
b := make([]byte, 4)
994994
native.PutUint32(b, uint32(maxSize))
995995

996-
data := nl.NewRtAttr(nl.IFLA_GRO_MAX_SIZE, b)
996+
data := nl.NewRtAttr(unix.IFLA_GRO_MAX_SIZE, b)
997997
req.AddData(data)
998998

999999
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
@@ -1456,7 +1456,7 @@ func (h *Handle) linkModify(link Link, flags int) error {
14561456
}
14571457

14581458
if base.GROMaxSize > 0 {
1459-
groAttr := nl.NewRtAttr(nl.IFLA_GRO_MAX_SIZE, nl.Uint32Attr(base.GROMaxSize))
1459+
groAttr := nl.NewRtAttr(unix.IFLA_GRO_MAX_SIZE, nl.Uint32Attr(base.GROMaxSize))
14601460
req.AddData(groAttr)
14611461
}
14621462

@@ -2000,7 +2000,7 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) {
20002000
base.GSOMaxSize = native.Uint32(attr.Value[0:4])
20012001
case unix.IFLA_GSO_MAX_SEGS:
20022002
base.GSOMaxSegs = native.Uint32(attr.Value[0:4])
2003-
case nl.IFLA_GRO_MAX_SIZE:
2003+
case unix.IFLA_GRO_MAX_SIZE:
20042004
base.GROMaxSize = native.Uint32(attr.Value[0:4])
20052005
case unix.IFLA_VFINFO_LIST:
20062006
data, err := nl.ParseRouteAttr(attr.Value)

nl/link_linux.go

-5
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,3 @@ const (
718718
IFLA_BAREUDP_MULTIPROTO_MODE
719719
IFLA_BAREUDP_MAX = IFLA_BAREUDP_MULTIPROTO_MODE
720720
)
721-
722-
const (
723-
IFLA_UNSPEC = iota
724-
IFLA_GRO_MAX_SIZE = 0x3a
725-
)

0 commit comments

Comments
 (0)