mirror of https://github.com/vishvananda/netlink
Use IFLA_G{S,R}O_IPV4_MAX_SIZE constants from golang.org/x/sys/unix
Commit 2b008399a4
("link: add LinkSetGSOIPv4MaxSize and
LinkSetGROIPv4MaxSize") introduced the use of these constants, but they
were added only recently to the golang.org/x/sys/unix package. Update
its version in go.mod and use the pre-defined constants instead of
duplicating them.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
This commit is contained in:
parent
a8a91c0504
commit
77712cff87
2
go.mod
2
go.mod
|
@ -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-20220804214406-8e32c043e418
|
golang.org/x/sys v0.9.1-0.20230616193735-e0c3b6e6ae3b
|
||||||
)
|
)
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +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/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME=
|
golang.org/x/sys v0.9.1-0.20230616193735-e0c3b6e6ae3b h1:5elkVbSN5WHw2BspeECIoFRcbpHNAZJEU8jlgEQl3p0=
|
||||||
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.9.1-0.20230616193735-e0c3b6e6ae3b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
|
|
@ -1030,7 +1030,7 @@ func (h *Handle) LinkSetGSOIPv4MaxSize(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_GSO_IPV4_MAX_SIZE, b)
|
data := nl.NewRtAttr(unix.IFLA_GSO_IPV4_MAX_SIZE, b)
|
||||||
req.AddData(data)
|
req.AddData(data)
|
||||||
|
|
||||||
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
||||||
|
@ -1057,7 +1057,7 @@ func (h *Handle) LinkSetGROIPv4MaxSize(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_IPV4_MAX_SIZE, b)
|
data := nl.NewRtAttr(unix.IFLA_GRO_IPV4_MAX_SIZE, b)
|
||||||
req.AddData(data)
|
req.AddData(data)
|
||||||
|
|
||||||
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
_, err := req.Execute(unix.NETLINK_ROUTE, 0)
|
||||||
|
@ -1525,12 +1525,12 @@ func (h *Handle) linkModify(link Link, flags int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if base.GSOIPv4MaxSize > 0 {
|
if base.GSOIPv4MaxSize > 0 {
|
||||||
gsoAttr := nl.NewRtAttr(nl.IFLA_GSO_IPV4_MAX_SIZE, nl.Uint32Attr(base.GSOIPv4MaxSize))
|
gsoAttr := nl.NewRtAttr(unix.IFLA_GSO_IPV4_MAX_SIZE, nl.Uint32Attr(base.GSOIPv4MaxSize))
|
||||||
req.AddData(gsoAttr)
|
req.AddData(gsoAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if base.GROIPv4MaxSize > 0 {
|
if base.GROIPv4MaxSize > 0 {
|
||||||
groAttr := nl.NewRtAttr(nl.IFLA_GRO_IPV4_MAX_SIZE, nl.Uint32Attr(base.GROIPv4MaxSize))
|
groAttr := nl.NewRtAttr(unix.IFLA_GRO_IPV4_MAX_SIZE, nl.Uint32Attr(base.GROIPv4MaxSize))
|
||||||
req.AddData(groAttr)
|
req.AddData(groAttr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2080,9 +2080,9 @@ 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_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 nl.IFLA_GSO_IPV4_MAX_SIZE:
|
case unix.IFLA_GSO_IPV4_MAX_SIZE:
|
||||||
base.GSOIPv4MaxSize = native.Uint32(attr.Value[0:4])
|
base.GSOIPv4MaxSize = native.Uint32(attr.Value[0:4])
|
||||||
case nl.IFLA_GRO_IPV4_MAX_SIZE:
|
case unix.IFLA_GRO_IPV4_MAX_SIZE:
|
||||||
base.GROIPv4MaxSize = native.Uint32(attr.Value[0:4])
|
base.GROIPv4MaxSize = 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)
|
||||||
|
|
|
@ -20,11 +20,6 @@ const (
|
||||||
IFLA_INFO_MAX = IFLA_INFO_SLAVE_DATA
|
IFLA_INFO_MAX = IFLA_INFO_SLAVE_DATA
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
IFLA_GSO_IPV4_MAX_SIZE = 63
|
|
||||||
IFLA_GRO_IPV4_MAX_SIZE = 64
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
IFLA_VLAN_UNSPEC = iota
|
IFLA_VLAN_UNSPEC = iota
|
||||||
IFLA_VLAN_ID
|
IFLA_VLAN_ID
|
||||||
|
|
Loading…
Reference in New Issue