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 c94808a88b ("link: add
support for IFLA_GRO_MAX_SIZE").

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
Tobias Klauser 2022-08-05 23:44:26 +02:00 committed by Alessandro Boch
parent 6e2993d135
commit afa2eb2a66
4 changed files with 6 additions and 12 deletions

2
go.mod
View File

@ -4,5 +4,5 @@ go 1.12
require ( require (
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1 golang.org/x/sys v0.0.0-20220804214406-8e32c043e418
) )

5
go.sum
View File

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

View File

@ -993,7 +993,7 @@ func (h *Handle) LinkSetGROMaxSize(link Link, maxSize int) error {
b := make([]byte, 4) b := make([]byte, 4)
native.PutUint32(b, uint32(maxSize)) native.PutUint32(b, uint32(maxSize))
data := nl.NewRtAttr(nl.IFLA_GRO_MAX_SIZE, b) data := nl.NewRtAttr(unix.IFLA_GRO_MAX_SIZE, b)
req.AddData(data) req.AddData(data)
_, err := req.Execute(unix.NETLINK_ROUTE, 0) _, err := req.Execute(unix.NETLINK_ROUTE, 0)
@ -1456,7 +1456,7 @@ func (h *Handle) linkModify(link Link, flags int) error {
} }
if base.GROMaxSize > 0 { if base.GROMaxSize > 0 {
groAttr := nl.NewRtAttr(nl.IFLA_GRO_MAX_SIZE, nl.Uint32Attr(base.GROMaxSize)) groAttr := nl.NewRtAttr(unix.IFLA_GRO_MAX_SIZE, nl.Uint32Attr(base.GROMaxSize))
req.AddData(groAttr) req.AddData(groAttr)
} }
@ -2000,7 +2000,7 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) {
base.GSOMaxSize = native.Uint32(attr.Value[0:4]) base.GSOMaxSize = native.Uint32(attr.Value[0:4])
case unix.IFLA_GSO_MAX_SEGS: case unix.IFLA_GSO_MAX_SEGS:
base.GSOMaxSegs = native.Uint32(attr.Value[0:4]) base.GSOMaxSegs = native.Uint32(attr.Value[0:4])
case nl.IFLA_GRO_MAX_SIZE: case unix.IFLA_GRO_MAX_SIZE:
base.GROMaxSize = native.Uint32(attr.Value[0:4]) base.GROMaxSize = native.Uint32(attr.Value[0:4])
case unix.IFLA_VFINFO_LIST: case unix.IFLA_VFINFO_LIST:
data, err := nl.ParseRouteAttr(attr.Value) data, err := nl.ParseRouteAttr(attr.Value)

View File

@ -718,8 +718,3 @@ const (
IFLA_BAREUDP_MULTIPROTO_MODE IFLA_BAREUDP_MULTIPROTO_MODE
IFLA_BAREUDP_MAX = IFLA_BAREUDP_MULTIPROTO_MODE IFLA_BAREUDP_MAX = IFLA_BAREUDP_MULTIPROTO_MODE
) )
const (
IFLA_UNSPEC = iota
IFLA_GRO_MAX_SIZE = 0x3a
)