update github.com/docker/libnetwork to f0e46a7 - which bumps it's dependency to github.com/vishvananda/netlink to v1.0.0

Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
Co-authored-by: Moriadry <preciousdp11@gmail.com>
This commit is contained in:
Andrew Sy Kim
2019-10-07 13:33:33 -04:00
parent d8706f04b9
commit bbca2594f5
7 changed files with 115 additions and 12 deletions

View File

@@ -3,14 +3,13 @@
package ipvs
import (
"net"
"syscall"
"time"
"fmt"
"net"
"time"
"github.com/vishvananda/netlink/nl"
"github.com/vishvananda/netns"
"golang.org/x/sys/unix"
)
const (
@@ -62,6 +61,17 @@ type Destination struct {
LowerThreshold uint32
ActiveConnections int
InactiveConnections int
Stats DstStats
}
// DstStats defines IPVS destination (real server) statistics
type DstStats SvcStats
// Config defines IPVS timeout configuration
type Config struct {
TimeoutTCP time.Duration
TimeoutTCPFin time.Duration
TimeoutUDP time.Duration
}
// Handle provides a namespace specific ipvs handle to program ipvs
@@ -87,16 +97,16 @@ func New(path string) (*Handle, error) {
}
defer n.Close()
sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC)
sock, err := nl.GetNetlinkSocketAt(n, netns.None(), unix.NETLINK_GENERIC)
if err != nil {
return nil, err
}
// Add operation timeout to avoid deadlocks
tv := syscall.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())
tv := unix.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())
if err := sock.SetSendTimeout(&tv); err != nil {
return nil, err
}
tv = syscall.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())
tv = unix.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())
if err := sock.SetReceiveTimeout(&tv); err != nil {
return nil, err
}
@@ -184,3 +194,13 @@ func (i *Handle) GetService(s *Service) (*Service, error) {
return res[0], nil
}
// GetConfig returns the current timeout configuration
func (i *Handle) GetConfig() (*Config, error) {
return i.doGetConfigCmd()
}
// SetConfig set the current timeout configuration. 0: no change
func (i *Handle) SetConfig(c *Config) error {
return i.doSetConfigCmd(c)
}