From afa2eb2a66aac1f8f370287f236ba93d4c078dd6 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 5 Aug 2022 23:44:26 +0200 Subject: [PATCH] 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 c94808a88ba4 ("link: add support for IFLA_GRO_MAX_SIZE"). Signed-off-by: Tobias Klauser --- go.mod | 2 +- go.sum | 5 ++--- link_linux.go | 6 +++--- nl/link_linux.go | 5 ----- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 9d8455e..e7fa06d 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,5 @@ go 1.12 require ( 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 ) diff --git a/go.sum b/go.sum index ed5d308..eb43c9e 100644 --- a/go.sum +++ b/go.sum @@ -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/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-20200728102440-3e129f6d46b1 h1:sIky/MyNRSHTrdxfsiUSS4WIAMvInbeXljJz+jDjeYE= -golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME= +golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/link_linux.go b/link_linux.go index 2703391..cc80fb6 100644 --- a/link_linux.go +++ b/link_linux.go @@ -993,7 +993,7 @@ func (h *Handle) LinkSetGROMaxSize(link Link, maxSize int) error { b := make([]byte, 4) 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) _, err := req.Execute(unix.NETLINK_ROUTE, 0) @@ -1456,7 +1456,7 @@ func (h *Handle) linkModify(link Link, flags int) error { } 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) } @@ -2000,7 +2000,7 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) { base.GSOMaxSize = native.Uint32(attr.Value[0:4]) case unix.IFLA_GSO_MAX_SEGS: 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]) case unix.IFLA_VFINFO_LIST: data, err := nl.ParseRouteAttr(attr.Value) diff --git a/nl/link_linux.go b/nl/link_linux.go index edf1c80..e10edbc 100644 --- a/nl/link_linux.go +++ b/nl/link_linux.go @@ -718,8 +718,3 @@ const ( IFLA_BAREUDP_MULTIPROTO_MODE IFLA_BAREUDP_MAX = IFLA_BAREUDP_MULTIPROTO_MODE ) - -const ( - IFLA_UNSPEC = iota - IFLA_GRO_MAX_SIZE = 0x3a -)