Update to new release of moby/ipvs
hack/pin-dependency.sh github.com/moby/ipvs v1.1.0 - go to a fixed tag for `vishvananda/netns` - no more references to `pkg/errors` Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
8
vendor/github.com/moby/ipvs/.golangci.yml
generated
vendored
Normal file
8
vendor/github.com/moby/ipvs/.golangci.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- gofmt
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- revive
|
8
vendor/github.com/moby/ipvs/LICENSE
generated
vendored
8
vendor/github.com/moby/ipvs/LICENSE
generated
vendored
@@ -1,4 +1,5 @@
|
||||
Apache License
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
@@ -178,7 +179,7 @@ Apache License
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
@@ -186,7 +187,7 @@ Apache License
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -199,4 +200,3 @@ Apache License
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
3
vendor/github.com/moby/ipvs/README.md
generated
vendored
3
vendor/github.com/moby/ipvs/README.md
generated
vendored
@@ -31,4 +31,5 @@ func main() {
|
||||
Want to hack on ipvs? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
|
||||
|
||||
## Copyright and license
|
||||
Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
|
||||
|
||||
Copyright 2015 Docker, inc. Code released under the [Apache 2.0 license](LICENSE).
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// +build linux
|
||||
|
||||
package ipvs
|
||||
|
||||
const (
|
||||
@@ -88,20 +86,20 @@ const (
|
||||
ipvsDestAttrAddressFamily
|
||||
)
|
||||
|
||||
// IPVS Svc Statistics constancs
|
||||
// IPVS Statistics constants
|
||||
|
||||
const (
|
||||
ipvsSvcStatsUnspec int = iota
|
||||
ipvsSvcStatsConns
|
||||
ipvsSvcStatsPktsIn
|
||||
ipvsSvcStatsPktsOut
|
||||
ipvsSvcStatsBytesIn
|
||||
ipvsSvcStatsBytesOut
|
||||
ipvsSvcStatsCPS
|
||||
ipvsSvcStatsPPSIn
|
||||
ipvsSvcStatsPPSOut
|
||||
ipvsSvcStatsBPSIn
|
||||
ipvsSvcStatsBPSOut
|
||||
ipvsStatsUnspec int = iota
|
||||
ipvsStatsConns
|
||||
ipvsStatsPktsIn
|
||||
ipvsStatsPktsOut
|
||||
ipvsStatsBytesIn
|
||||
ipvsStatsBytesOut
|
||||
ipvsStatsCPS
|
||||
ipvsStatsPPSIn
|
||||
ipvsStatsPPSOut
|
||||
ipvsStatsBPSIn
|
||||
ipvsStatsBPSOut
|
||||
)
|
||||
|
||||
// Destination forwarding methods
|
3
vendor/github.com/moby/ipvs/ipvs.go → vendor/github.com/moby/ipvs/ipvs_linux.go
generated
vendored
3
vendor/github.com/moby/ipvs/ipvs.go → vendor/github.com/moby/ipvs/ipvs_linux.go
generated
vendored
@@ -1,5 +1,3 @@
|
||||
// +build linux
|
||||
|
||||
package ipvs
|
||||
|
||||
import (
|
||||
@@ -181,7 +179,6 @@ func (i *Handle) GetDestinations(s *Service) ([]*Destination, error) {
|
||||
|
||||
// GetService gets details of a specific IPVS services, useful in updating statisics etc.,
|
||||
func (i *Handle) GetService(s *Service) (*Service, error) {
|
||||
|
||||
res, err := i.doGetServicesCmd(s)
|
||||
if err != nil {
|
||||
return nil, err
|
58
vendor/github.com/moby/ipvs/netlink.go → vendor/github.com/moby/ipvs/netlink_linux.go
generated
vendored
58
vendor/github.com/moby/ipvs/netlink.go → vendor/github.com/moby/ipvs/netlink_linux.go
generated
vendored
@@ -1,5 +1,3 @@
|
||||
// +build linux
|
||||
|
||||
package ipvs
|
||||
|
||||
import (
|
||||
@@ -124,8 +122,8 @@ func (i *Handle) doCmdwithResponse(s *Service, d *Destination, cmd uint8) ([][]b
|
||||
req.Seq = atomic.AddUint32(&i.seq, 1)
|
||||
|
||||
if s == nil {
|
||||
req.Flags |= syscall.NLM_F_DUMP //Flag to dump all messages
|
||||
req.AddData(nl.NewRtAttr(ipvsCmdAttrService, nil)) //Add a dummy attribute
|
||||
req.Flags |= syscall.NLM_F_DUMP // Flag to dump all messages
|
||||
req.AddData(nl.NewRtAttr(ipvsCmdAttrService, nil)) // Add a dummy attribute
|
||||
} else {
|
||||
req.AddData(fillService(s))
|
||||
}
|
||||
@@ -134,7 +132,6 @@ func (i *Handle) doCmdwithResponse(s *Service, d *Destination, cmd uint8) ([][]b
|
||||
if cmd == ipvsCmdGetDest {
|
||||
req.Flags |= syscall.NLM_F_DUMP
|
||||
}
|
||||
|
||||
} else {
|
||||
req.AddData(fillDestination(d))
|
||||
}
|
||||
@@ -259,7 +256,6 @@ done:
|
||||
}
|
||||
|
||||
func parseIP(ip []byte, family uint16) (net.IP, error) {
|
||||
|
||||
var resIP net.IP
|
||||
|
||||
switch family {
|
||||
@@ -276,7 +272,6 @@ func parseIP(ip []byte, family uint16) (net.IP, error) {
|
||||
|
||||
// parseStats
|
||||
func assembleStats(msg []byte) (SvcStats, error) {
|
||||
|
||||
var s SvcStats
|
||||
|
||||
attrs, err := nl.ParseRouteAttr(msg)
|
||||
@@ -287,25 +282,25 @@ func assembleStats(msg []byte) (SvcStats, error) {
|
||||
for _, attr := range attrs {
|
||||
attrType := int(attr.Attr.Type)
|
||||
switch attrType {
|
||||
case ipvsSvcStatsConns:
|
||||
case ipvsStatsConns:
|
||||
s.Connections = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsPktsIn:
|
||||
case ipvsStatsPktsIn:
|
||||
s.PacketsIn = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsPktsOut:
|
||||
case ipvsStatsPktsOut:
|
||||
s.PacketsOut = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsBytesIn:
|
||||
case ipvsStatsBytesIn:
|
||||
s.BytesIn = native.Uint64(attr.Value)
|
||||
case ipvsSvcStatsBytesOut:
|
||||
case ipvsStatsBytesOut:
|
||||
s.BytesOut = native.Uint64(attr.Value)
|
||||
case ipvsSvcStatsCPS:
|
||||
case ipvsStatsCPS:
|
||||
s.CPS = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsPPSIn:
|
||||
case ipvsStatsPPSIn:
|
||||
s.PPSIn = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsPPSOut:
|
||||
case ipvsStatsPPSOut:
|
||||
s.PPSOut = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsBPSIn:
|
||||
case ipvsStatsBPSIn:
|
||||
s.BPSIn = native.Uint32(attr.Value)
|
||||
case ipvsSvcStatsBPSOut:
|
||||
case ipvsStatsBPSOut:
|
||||
s.BPSOut = native.Uint32(attr.Value)
|
||||
}
|
||||
}
|
||||
@@ -314,7 +309,6 @@ func assembleStats(msg []byte) (SvcStats, error) {
|
||||
|
||||
// assembleService assembles a services back from a hain of netlink attributes
|
||||
func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
|
||||
|
||||
var s Service
|
||||
var addressBytes []byte
|
||||
|
||||
@@ -366,10 +360,9 @@ func assembleService(attrs []syscall.NetlinkRouteAttr) (*Service, error) {
|
||||
|
||||
// parseService given a ipvs netlink response this function will respond with a valid service entry, an error otherwise
|
||||
func (i *Handle) parseService(msg []byte) (*Service, error) {
|
||||
|
||||
var s *Service
|
||||
|
||||
//Remove General header for this message and parse the NetLink message
|
||||
// Remove General header for this message and parse the NetLink message
|
||||
hdr := deserializeGenlMsg(msg)
|
||||
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
|
||||
if err != nil {
|
||||
@@ -379,13 +372,13 @@ func (i *Handle) parseService(msg []byte) (*Service, error) {
|
||||
return nil, fmt.Errorf("error no valid netlink message found while parsing service record")
|
||||
}
|
||||
|
||||
//Now Parse and get IPVS related attributes messages packed in this message.
|
||||
// Now Parse and get IPVS related attributes messages packed in this message.
|
||||
ipvsAttrs, err := nl.ParseRouteAttr(NetLinkAttrs[0].Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//Assemble all the IPVS related attribute messages and create a service record
|
||||
// Assemble all the IPVS related attribute messages and create a service record
|
||||
s, err = assembleService(ipvsAttrs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -422,7 +415,6 @@ func (i *Handle) doCmdWithoutAttr(cmd uint8) ([][]byte, error) {
|
||||
}
|
||||
|
||||
func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error) {
|
||||
|
||||
var d Destination
|
||||
var addressBytes []byte
|
||||
|
||||
@@ -447,9 +439,9 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
|
||||
case ipvsDestAttrLowerThreshold:
|
||||
d.LowerThreshold = native.Uint32(attr.Value)
|
||||
case ipvsDestAttrActiveConnections:
|
||||
d.ActiveConnections = int(native.Uint16(attr.Value))
|
||||
d.ActiveConnections = int(native.Uint32(attr.Value))
|
||||
case ipvsDestAttrInactiveConnections:
|
||||
d.InactiveConnections = int(native.Uint16(attr.Value))
|
||||
d.InactiveConnections = int(native.Uint32(attr.Value))
|
||||
case ipvsDestAttrStats:
|
||||
stats, err := assembleStats(attr.Value)
|
||||
if err != nil {
|
||||
@@ -486,9 +478,12 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
|
||||
|
||||
// getIPFamily parses the IP family based on raw data from netlink.
|
||||
// For AF_INET, netlink will set the first 4 bytes with trailing zeros
|
||||
// 10.0.0.1 -> [10 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
|
||||
//
|
||||
// 10.0.0.1 -> [10 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]
|
||||
//
|
||||
// For AF_INET6, the full 16 byte array is used:
|
||||
// 2001:db8:3c4d:15::1a00 -> [32 1 13 184 60 77 0 21 0 0 0 0 0 0 26 0]
|
||||
//
|
||||
// 2001:db8:3c4d:15::1a00 -> [32 1 13 184 60 77 0 21 0 0 0 0 0 0 26 0]
|
||||
func getIPFamily(address []byte) (uint16, error) {
|
||||
if len(address) == 4 {
|
||||
return syscall.AF_INET, nil
|
||||
@@ -519,7 +514,7 @@ func isZeros(b []byte) bool {
|
||||
func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
|
||||
var dst *Destination
|
||||
|
||||
//Remove General header for this message
|
||||
// Remove General header for this message
|
||||
hdr := deserializeGenlMsg(msg)
|
||||
NetLinkAttrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
|
||||
if err != nil {
|
||||
@@ -529,13 +524,13 @@ func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
|
||||
return nil, fmt.Errorf("error no valid netlink message found while parsing destination record")
|
||||
}
|
||||
|
||||
//Now Parse and get IPVS related attributes messages packed in this message.
|
||||
// Now Parse and get IPVS related attributes messages packed in this message.
|
||||
ipvsAttrs, err := nl.ParseRouteAttr(NetLinkAttrs[0].Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//Assemble netlink attributes and create a Destination record
|
||||
// Assemble netlink attributes and create a Destination record
|
||||
dst, err = assembleDestination(ipvsAttrs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -546,7 +541,6 @@ func (i *Handle) parseDestination(msg []byte) (*Destination, error) {
|
||||
|
||||
// doGetDestinationsCmd a wrapper function to be used by GetDestinations and GetDestination(d) apis
|
||||
func (i *Handle) doGetDestinationsCmd(s *Service, d *Destination) ([]*Destination, error) {
|
||||
|
||||
var res []*Destination
|
||||
|
||||
msgs, err := i.doCmdwithResponse(s, d, ipvsCmdGetDest)
|
||||
@@ -568,7 +562,7 @@ func (i *Handle) doGetDestinationsCmd(s *Service, d *Destination) ([]*Destinatio
|
||||
func (i *Handle) parseConfig(msg []byte) (*Config, error) {
|
||||
var c Config
|
||||
|
||||
//Remove General header for this message
|
||||
// Remove General header for this message
|
||||
hdr := deserializeGenlMsg(msg)
|
||||
attrs, err := nl.ParseRouteAttr(msg[hdr.Len():])
|
||||
if err != nil {
|
Reference in New Issue
Block a user