From f943fd7d2427fbf893b9e0795528500fc99081b8 Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Sat, 30 Jan 2016 20:03:03 -0800 Subject: [PATCH] Vendoring libnetwork 0.6.0-rc6 Signed-off-by: Alessandro Boch --- hack/vendor.sh | 2 +- .../github.com/docker/libnetwork/CHANGELOG.md | 3 +++ .../libnetwork/drivers/overlay/joinleave.go | 25 ++++++------------- .../libnetwork/drivers/overlay/ov_endpoint.go | 16 ++++++++++++ .../libnetwork/drivers/overlay/ov_network.go | 4 ++- .../docker/libnetwork/osl/interface_linux.go | 5 ++-- .../github.com/docker/libnetwork/sandbox.go | 2 +- 7 files changed, 35 insertions(+), 22 deletions(-) diff --git a/hack/vendor.sh b/hack/vendor.sh index 70f766c94e..5c91621f26 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -27,7 +27,7 @@ clone git github.com/RackSec/srslog 6eb773f331e46fbba8eecb8e794e635e75fc04de clone git github.com/imdario/mergo 0.2.1 #get libnetwork packages -clone git github.com/docker/libnetwork v0.6.0-rc5 +clone git github.com/docker/libnetwork v0.6.0-rc6 clone git github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec clone git github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b clone git github.com/hashicorp/memberlist 9a1e242e454d2443df330bdd51a436d5a9058fc4 diff --git a/vendor/src/github.com/docker/libnetwork/CHANGELOG.md b/vendor/src/github.com/docker/libnetwork/CHANGELOG.md index ebcefeb0f3..2cad329304 100644 --- a/vendor/src/github.com/docker/libnetwork/CHANGELOG.md +++ b/vendor/src/github.com/docker/libnetwork/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 0.6.0-rc6 (2016-01-30) +- Properly fixes https://github.com/docker/docker/issues/18814 + ## 0.6.0-rc5 (2016-01-26) - Cleanup stale overlay sandboxes diff --git a/vendor/src/github.com/docker/libnetwork/drivers/overlay/joinleave.go b/vendor/src/github.com/docker/libnetwork/drivers/overlay/joinleave.go index a520453a63..d87c032dfc 100644 --- a/vendor/src/github.com/docker/libnetwork/drivers/overlay/joinleave.go +++ b/vendor/src/github.com/docker/libnetwork/drivers/overlay/joinleave.go @@ -49,33 +49,33 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, sbox := n.sandbox() - name1, name2, err := createVethPair() + overlayIfName, containerIfName, err := createVethPair() if err != nil { return err } - ep.ifName = name2 + ep.ifName = overlayIfName // Set the container interface and its peer MTU to 1450 to allow // for 50 bytes vxlan encap (inner eth header(14) + outer IP(20) + // outer UDP(8) + vxlan header(8)) - veth, err := netlink.LinkByName(name1) + veth, err := netlink.LinkByName(overlayIfName) if err != nil { - return fmt.Errorf("cound not find link by name %s: %v", name1, err) + return fmt.Errorf("cound not find link by name %s: %v", overlayIfName, err) } err = netlink.LinkSetMTU(veth, vxlanVethMTU) if err != nil { return err } - if err := sbox.AddInterface(name1, "veth", + if err := sbox.AddInterface(overlayIfName, "veth", sbox.InterfaceOptions().Master(s.brName)); err != nil { return fmt.Errorf("could not add veth pair inside the network sandbox: %v", err) } - veth, err = netlink.LinkByName(name2) + veth, err = netlink.LinkByName(containerIfName) if err != nil { - return fmt.Errorf("could not find link by name %s: %v", name2, err) + return fmt.Errorf("could not find link by name %s: %v", containerIfName, err) } err = netlink.LinkSetMTU(veth, vxlanVethMTU) if err != nil { @@ -96,7 +96,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, } if iNames := jinfo.InterfaceName(); iNames != nil { - err = iNames.SetNames(name2, "eth") + err = iNames.SetNames(containerIfName, "eth") if err != nil { return err } @@ -136,14 +136,5 @@ func (d *driver) Leave(nid, eid string) error { n.leaveSandbox() - link, err := netlink.LinkByName(ep.ifName) - if err != nil { - log.Warnf("Failed to retrieve interface link for interface removal on endpoint leave: %v", err) - return nil - } - if err := netlink.LinkDel(link); err != nil { - log.Warnf("Failed to delete interface link on endpoint leave: %v", err) - } - return nil } diff --git a/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_endpoint.go b/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_endpoint.go index c3fe10cf5a..2dd288fd26 100644 --- a/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_endpoint.go +++ b/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_endpoint.go @@ -4,8 +4,10 @@ import ( "fmt" "net" + log "github.com/Sirupsen/logrus" "github.com/docker/libnetwork/driverapi" "github.com/docker/libnetwork/netutils" + "github.com/vishvananda/netlink" ) type endpointTable map[string]*endpoint @@ -97,6 +99,20 @@ func (d *driver) DeleteEndpoint(nid, eid string) error { } n.deleteEndpoint(eid) + + if ep.ifName == "" { + return nil + } + + link, err := netlink.LinkByName(ep.ifName) + if err != nil { + log.Debugf("Failed to retrieve interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err) + return nil + } + if err := netlink.LinkDel(link); err != nil { + log.Debugf("Failed to delete interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err) + } + return nil } diff --git a/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_network.go b/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_network.go index dc092ef359..f0b9b2b1f5 100644 --- a/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_network.go +++ b/vendor/src/github.com/docker/libnetwork/drivers/overlay/ov_network.go @@ -160,7 +160,9 @@ func (n *network) destroySandbox() { sbox := n.sandbox() if sbox != nil { for _, iface := range sbox.Info().Interfaces() { - iface.Remove() + if err := iface.Remove(); err != nil { + logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err) + } } for _, s := range n.subnets { diff --git a/vendor/src/github.com/docker/libnetwork/osl/interface_linux.go b/vendor/src/github.com/docker/libnetwork/osl/interface_linux.go index 7c569d63bb..de74ee4852 100644 --- a/vendor/src/github.com/docker/libnetwork/osl/interface_linux.go +++ b/vendor/src/github.com/docker/libnetwork/osl/interface_linux.go @@ -8,6 +8,7 @@ import ( "sync" "syscall" + log "github.com/Sirupsen/logrus" "github.com/docker/libnetwork/types" "github.com/vishvananda/netlink" ) @@ -127,7 +128,7 @@ func (i *nwIface) Remove() error { err = netlink.LinkSetName(iface, i.SrcName()) if err != nil { - fmt.Println("LinkSetName failed: ", err) + log.Debugf("LinkSetName failed for interface %s: %v", i.SrcName(), err) return err } @@ -139,7 +140,7 @@ func (i *nwIface) Remove() error { } else if !isDefault { // Move the network interface to caller namespace. if err := netlink.LinkSetNsFd(iface, callerFD); err != nil { - fmt.Println("LinkSetNsPid failed: ", err) + log.Debugf("LinkSetNsPid failed for interface %s: %v", i.SrcName(), err) return err } } diff --git a/vendor/src/github.com/docker/libnetwork/sandbox.go b/vendor/src/github.com/docker/libnetwork/sandbox.go index 92a036dfa0..71c8ebb753 100644 --- a/vendor/src/github.com/docker/libnetwork/sandbox.go +++ b/vendor/src/github.com/docker/libnetwork/sandbox.go @@ -589,7 +589,7 @@ func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) { // Only remove the interfaces owned by this endpoint from the sandbox. if ep.hasInterface(i.SrcName()) { if err := i.Remove(); err != nil { - log.Debugf("Remove interface failed: %v", err) + log.Debugf("Remove interface %s failed: %v", i.SrcName(), err) } } }