From 9754be0f4aa574d9ea7a88cef2b10723d8b71764 Mon Sep 17 00:00:00 2001 From: Madhu Venugopal Date: Fri, 7 Aug 2015 16:40:32 -0700 Subject: [PATCH] Updated Godeps to the latest vishvanandha/netlink Signed-off-by: Madhu Venugopal --- Godeps/Godeps.json | 9 ++++----- .../src/github.com/vishvananda/netlink/nl/nl_linux.go | 3 ++- .../src/github.com/vishvananda/netlink/nl/route_linux.go | 9 +++++++++ .../src/github.com/vishvananda/netlink/route_linux.go | 7 +++---- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 3e344c3..b7504d6 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -69,11 +69,6 @@ "Comment": "v1.4.1-4106-g637023a", "Rev": "637023a5f8d8347a0e271c09d5c9bc84fbc97693" }, - { - "ImportPath": "github.com/docker/libcontainer/netlink", - "Comment": "v1.4.0-495-g3e66118", - "Rev": "3e661186ba24f259d3860f067df052c7f6904bee" - }, { "ImportPath": "github.com/docker/libcontainer/user", "Comment": "v1.4.0-495-g3e66118", @@ -133,6 +128,10 @@ { "ImportPath": "github.com/vishvananda/netns", "Rev": "493029407eeb434d0c2d44e02ea072ff2488d322" + }, + { + "ImportPath": "github.com/vishvananda/netlink", + "Rev": "329b40d4e308deb2abe80dbb1f74078e5ab13164" } ] } diff --git a/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go b/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go index a554adb..3cb137d 100644 --- a/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go +++ b/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go @@ -39,8 +39,9 @@ func NativeEndian() binary.ByteOrder { var x uint32 = 0x01020304 if *(*byte)(unsafe.Pointer(&x)) == 0x01 { nativeEndian = binary.BigEndian + } else { + nativeEndian = binary.LittleEndian } - nativeEndian = binary.LittleEndian } return nativeEndian } diff --git a/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go b/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go index 5dde998..447e83e 100644 --- a/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go +++ b/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go @@ -20,6 +20,15 @@ func NewRtMsg() *RtMsg { } } +func NewRtDelMsg() *RtMsg { + return &RtMsg{ + RtMsg: syscall.RtMsg{ + Table: syscall.RT_TABLE_MAIN, + Scope: syscall.RT_SCOPE_NOWHERE, + }, + } +} + func (msg *RtMsg) Len() int { return syscall.SizeofRtMsg } diff --git a/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go b/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go index 88fa6db..3890895 100644 --- a/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go +++ b/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go @@ -14,22 +14,21 @@ import ( // Equivalent to: `ip route add $route` func RouteAdd(route *Route) error { req := nl.NewNetlinkRequest(syscall.RTM_NEWROUTE, syscall.NLM_F_CREATE|syscall.NLM_F_EXCL|syscall.NLM_F_ACK) - return routeHandle(route, req) + return routeHandle(route, req, nl.NewRtMsg()) } // RouteAdd will delete a route from the system. // Equivalent to: `ip route del $route` func RouteDel(route *Route) error { req := nl.NewNetlinkRequest(syscall.RTM_DELROUTE, syscall.NLM_F_ACK) - return routeHandle(route, req) + return routeHandle(route, req, nl.NewRtDelMsg()) } -func routeHandle(route *Route, req *nl.NetlinkRequest) error { +func routeHandle(route *Route, req *nl.NetlinkRequest, msg *nl.RtMsg) error { if (route.Dst == nil || route.Dst.IP == nil) && route.Src == nil && route.Gw == nil { return fmt.Errorf("one of Dst.IP, Src, or Gw must not be nil") } - msg := nl.NewRtMsg() msg.Scope = uint8(route.Scope) family := -1 var rtAttrs []*nl.RtAttr