Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump vishvananda/netlink to 1.0.0 #2366

Merged
merged 2 commits into from
Jun 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions drivers/overlay/ov_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strconv"
"strings"
"sync"
"syscall"

"github.com/docker/docker/pkg/reexec"
"github.com/docker/libnetwork/datastore"
Expand All @@ -27,6 +26,7 @@ import (
"github.com/vishvananda/netlink"
"github.com/vishvananda/netlink/nl"
"github.com/vishvananda/netns"
"golang.org/x/sys/unix"
)

var (
Expand Down Expand Up @@ -97,18 +97,18 @@ func setDefaultVlan() {
}

// make sure the sysfs mount doesn't propagate back
if err = syscall.Unshare(syscall.CLONE_NEWNS); err != nil {
if err = unix.Unshare(unix.CLONE_NEWNS); err != nil {
logrus.Errorf("unshare failed, %v", err)
os.Exit(1)
}

flag := syscall.MS_PRIVATE | syscall.MS_REC
if err = syscall.Mount("", "/", "", uintptr(flag), ""); err != nil {
flag := unix.MS_PRIVATE | unix.MS_REC
if err = unix.Mount("", "/", "", uintptr(flag), ""); err != nil {
logrus.Errorf("root mount failed, %v", err)
os.Exit(1)
}

if err = syscall.Mount("sysfs", "/sys", "sysfs", 0, ""); err != nil {
if err = unix.Mount("sysfs", "/sys", "sysfs", 0, ""); err != nil {
logrus.Errorf("mounting sysfs failed, %v", err)
os.Exit(1)
}
Expand Down Expand Up @@ -427,7 +427,7 @@ func populateVNITbl() {
}
defer ns.Close()

nlh, err := netlink.NewHandleAt(ns, syscall.NETLINK_ROUTE)
nlh, err := netlink.NewHandleAt(ns, unix.NETLINK_ROUTE)
if err != nil {
logrus.Errorf("Could not open netlink handle during vni population for ns %s: %v", path, err)
return nil
Expand Down Expand Up @@ -583,7 +583,7 @@ func (n *network) setupSubnetSandbox(s *subnet, brName, vxlanName string) error

if ok {
deleteVxlanByVNI(path, s.vni)
if err := syscall.Unmount(path, syscall.MNT_FORCE); err != nil {
if err := unix.Unmount(path, unix.MNT_FORCE); err != nil {
logrus.Errorf("unmount of %s failed: %v", path, err)
}
os.Remove(path)
Expand Down Expand Up @@ -693,7 +693,7 @@ func (n *network) cleanupStaleSandboxes() {
if strings.Contains(n.id, pattern) {
// Delete all vnis
deleteVxlanByVNI(path, 0)
syscall.Unmount(path, syscall.MNT_DETACH)
unix.Unmount(path, unix.MNT_DETACH)
os.Remove(path)

// Now that we have destroyed this
Expand Down Expand Up @@ -755,12 +755,12 @@ func (n *network) initSandbox(restore bool) error {

var nlSock *nl.NetlinkSocket
sbox.InvokeFunc(func() {
nlSock, err = nl.Subscribe(syscall.NETLINK_ROUTE, syscall.RTNLGRP_NEIGH)
nlSock, err = nl.Subscribe(unix.NETLINK_ROUTE, unix.RTNLGRP_NEIGH)
if err != nil {
return
}
// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
tv := syscall.NsecToTimeval(soTimeout.Nanoseconds())
tv := unix.NsecToTimeval(soTimeout.Nanoseconds())
err = nlSock.SetReceiveTimeout(&tv)
})
n.nlSocket = nlSock
Expand Down Expand Up @@ -803,7 +803,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
return
}
// When the receive timeout expires the receive will return EAGAIN
if err == syscall.EAGAIN {
if err == unix.EAGAIN {
// we continue here to avoid spam for timeouts
continue
}
Expand All @@ -812,7 +812,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
}

for _, msg := range msgs {
if msg.Header.Type != syscall.RTM_GETNEIGH && msg.Header.Type != syscall.RTM_NEWNEIGH {
if msg.Header.Type != unix.RTM_GETNEIGH && msg.Header.Type != unix.RTM_NEWNEIGH {
continue
}

Expand Down
4 changes: 3 additions & 1 deletion drivers/overlay/overlay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"testing"
"time"

"golang.org/x/sys/unix"

"github.com/docker/docker/pkg/plugingetter"
"github.com/docker/libkv/store/consul"
"github.com/docker/libnetwork/datastore"
Expand Down Expand Up @@ -150,7 +152,7 @@ func TestNetlinkSocket(t *testing.T) {
t.Fatal()
}
// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
tv := syscall.NsecToTimeval(soTimeout.Nanoseconds())
tv := unix.NsecToTimeval(soTimeout.Nanoseconds())
err = nlSock.SetReceiveTimeout(&tv)
if err != nil {
t.Fatal()
Expand Down
11 changes: 5 additions & 6 deletions ipvs/ipvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
package ipvs

import (
"fmt"
"net"
"syscall"
"time"

"fmt"

"github.com/vishvananda/netlink/nl"
"github.com/vishvananda/netns"
"golang.org/x/sys/unix"
)

const (
Expand Down Expand Up @@ -98,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
}
Expand Down
14 changes: 7 additions & 7 deletions ipvs/ipvs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ package ipvs

import (
"net"
"syscall"
"testing"
"time"

"github.com/docker/libnetwork/testutils"
"github.com/vishvananda/netlink"
"github.com/vishvananda/netlink/nl"
"golang.org/x/sys/unix"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
Expand Down Expand Up @@ -143,12 +143,12 @@ func TestService(t *testing.T) {
case "FWM":
s.FWMark = 1234
case "TCP":
s.Protocol = syscall.IPPROTO_TCP
s.Protocol = unix.IPPROTO_TCP
s.Port = 80
s.Address = net.ParseIP("1.2.3.4")
s.Netmask = 0xFFFFFFFF
case "UDP":
s.Protocol = syscall.IPPROTO_UDP
s.Protocol = unix.IPPROTO_UDP
s.Port = 53
s.Address = net.ParseIP("2.3.4.5")
}
Expand Down Expand Up @@ -183,15 +183,15 @@ func TestService(t *testing.T) {
{
AddressFamily: nl.FAMILY_V4,
SchedName: RoundRobin,
Protocol: syscall.IPPROTO_TCP,
Protocol: unix.IPPROTO_TCP,
Port: 80,
Address: net.ParseIP("10.20.30.40"),
Netmask: 0xFFFFFFFF,
},
{
AddressFamily: nl.FAMILY_V4,
SchedName: LeastConnection,
Protocol: syscall.IPPROTO_UDP,
Protocol: unix.IPPROTO_UDP,
Port: 8080,
Address: net.ParseIP("10.20.30.41"),
Netmask: 0xFFFFFFFF,
Expand Down Expand Up @@ -261,12 +261,12 @@ func TestDestination(t *testing.T) {
case "FWM":
s.FWMark = 1234
case "TCP":
s.Protocol = syscall.IPPROTO_TCP
s.Protocol = unix.IPPROTO_TCP
s.Port = 80
s.Address = net.ParseIP("1.2.3.4")
s.Netmask = 0xFFFFFFFF
case "UDP":
s.Protocol = syscall.IPPROTO_UDP
s.Protocol = unix.IPPROTO_UDP
s.Port = 53
s.Address = net.ParseIP("2.3.4.5")
}
Expand Down
4 changes: 2 additions & 2 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ github.com/opencontainers/runtime-spec 29686dbc5559d93fb1ef402eeda3e35c38d75af4
github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374
github.com/sirupsen/logrus f006c2ac4710855cf0f916dd6b77acf6b048dc6e # v1.0.3
github.com/ugorji/go b4c50a2b199d93b13dc15e78929cfb23bfdf21ab # v1.1.1
github.com/vishvananda/netlink b2de5d10e38ecce8607e6b438b6d174f389a004e
github.com/vishvananda/netns 604eaf189ee867d8c147fafc28def2394e878d25
github.com/vishvananda/netlink a2ad57a690f3caf3015351d2d6e1c0b95c349752 # v1.0.0
github.com/vishvananda/netns 13995c7128ccc8e51e9a6bd2b551020a27180abd
golang.org/x/crypto b7391e95e576cacdcdd422573063bc057239113d
golang.org/x/net a680a1efc54dd51c040b3b5ce4939ea3cf2ea0d1
golang.org/x/sys d455e41777fca6e8a5a79e34a14b8368bc11d9ba
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/vishvananda/netlink/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading