update vendor
This commit is contained in:
32
vendor/github.com/docker/libnetwork/ipvs/ipvs.go
generated
vendored
32
vendor/github.com/docker/libnetwork/ipvs/ipvs.go
generated
vendored
@@ -5,12 +5,19 @@ package ipvs
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"fmt"
|
||||
|
||||
"github.com/vishvananda/netlink/nl"
|
||||
"github.com/vishvananda/netns"
|
||||
)
|
||||
|
||||
const (
|
||||
netlinkRecvSocketsTimeout = 3 * time.Second
|
||||
netlinkSendSocketTimeout = 30 * time.Second
|
||||
)
|
||||
|
||||
// Service defines an IPVS service in its entirety.
|
||||
type Service struct {
|
||||
// Virtual service address.
|
||||
@@ -46,13 +53,15 @@ type SvcStats struct {
|
||||
// Destination defines an IPVS destination (real server) in its
|
||||
// entirety.
|
||||
type Destination struct {
|
||||
Address net.IP
|
||||
Port uint16
|
||||
Weight int
|
||||
ConnectionFlags uint32
|
||||
AddressFamily uint16
|
||||
UpperThreshold uint32
|
||||
LowerThreshold uint32
|
||||
Address net.IP
|
||||
Port uint16
|
||||
Weight int
|
||||
ConnectionFlags uint32
|
||||
AddressFamily uint16
|
||||
UpperThreshold uint32
|
||||
LowerThreshold uint32
|
||||
ActiveConnections int
|
||||
InactiveConnections int
|
||||
}
|
||||
|
||||
// Handle provides a namespace specific ipvs handle to program ipvs
|
||||
@@ -82,6 +91,15 @@ func New(path string) (*Handle, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Add operation timeout to avoid deadlocks
|
||||
tv := syscall.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())
|
||||
if err := sock.SetSendTimeout(&tv); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tv = syscall.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())
|
||||
if err := sock.SetReceiveTimeout(&tv); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Handle{sock: sock}, nil
|
||||
}
|
||||
|
19
vendor/github.com/docker/libnetwork/ipvs/netlink.go
generated
vendored
19
vendor/github.com/docker/libnetwork/ipvs/netlink.go
generated
vendored
@@ -100,7 +100,7 @@ func fillService(s *Service) nl.NetlinkRequestData {
|
||||
return cmdAttr
|
||||
}
|
||||
|
||||
func fillDestinaton(d *Destination) nl.NetlinkRequestData {
|
||||
func fillDestination(d *Destination) nl.NetlinkRequestData {
|
||||
cmdAttr := nl.NewRtAttr(ipvsCmdAttrDest, nil)
|
||||
|
||||
nl.NewRtAttrChild(cmdAttr, ipvsDestAttrAddress, rawIPData(d.Address))
|
||||
@@ -134,7 +134,7 @@ func (i *Handle) doCmdwithResponse(s *Service, d *Destination, cmd uint8) ([][]b
|
||||
}
|
||||
|
||||
} else {
|
||||
req.AddData(fillDestinaton(d))
|
||||
req.AddData(fillDestination(d))
|
||||
}
|
||||
|
||||
res, err := execute(i.sock, req, 0)
|
||||
@@ -203,10 +203,6 @@ func newGenlRequest(familyID int, cmd uint8) *nl.NetlinkRequest {
|
||||
}
|
||||
|
||||
func execute(s *nl.NetlinkSocket, req *nl.NetlinkRequest, resType uint16) ([][]byte, error) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
|
||||
if err := s.Send(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -222,6 +218,13 @@ done:
|
||||
for {
|
||||
msgs, err := s.Receive()
|
||||
if err != nil {
|
||||
if s.GetFd() == -1 {
|
||||
return nil, fmt.Errorf("Socket got closed on receive")
|
||||
}
|
||||
if err == syscall.EAGAIN {
|
||||
// timeout fired
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
for _, m := range msgs {
|
||||
@@ -436,6 +439,10 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
|
||||
d.LowerThreshold = native.Uint32(attr.Value)
|
||||
case ipvsDestAttrAddressFamily:
|
||||
d.AddressFamily = native.Uint16(attr.Value)
|
||||
case ipvsDestAttrActiveConnections:
|
||||
d.ActiveConnections = int(native.Uint16(attr.Value))
|
||||
case ipvsDestAttrInactiveConnections:
|
||||
d.InactiveConnections = int(native.Uint16(attr.Value))
|
||||
}
|
||||
}
|
||||
return &d, nil
|
||||
|
Reference in New Issue
Block a user