mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #448 from mavenugo/nl_godep
Updated Godeps to the latest vishvanandha/netlink
This commit is contained in:
commit
9b74f9d5ab
4 changed files with 18 additions and 10 deletions
9
libnetwork/Godeps/Godeps.json
generated
9
libnetwork/Godeps/Godeps.json
generated
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
3
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go
generated
vendored
3
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/nl_linux.go
generated
vendored
|
@ -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
|
||||
}
|
||||
|
|
9
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go
generated
vendored
9
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/nl/route_linux.go
generated
vendored
|
@ -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
|
||||
}
|
||||
|
|
7
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go
generated
vendored
7
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netlink/route_linux.go
generated
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue