summaryrefslogtreecommitdiff
path: root/vendor/github.com/vishvananda/netlink/nl/route_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vishvananda/netlink/nl/route_linux.go')
-rw-r--r--vendor/github.com/vishvananda/netlink/nl/route_linux.go39
1 files changed, 20 insertions, 19 deletions
diff --git a/vendor/github.com/vishvananda/netlink/nl/route_linux.go b/vendor/github.com/vishvananda/netlink/nl/route_linux.go
index 1a064d65d..f6906fcaf 100644
--- a/vendor/github.com/vishvananda/netlink/nl/route_linux.go
+++ b/vendor/github.com/vishvananda/netlink/nl/route_linux.go
@@ -1,65 +1,66 @@
package nl
import (
- "syscall"
"unsafe"
+
+ "golang.org/x/sys/unix"
)
type RtMsg struct {
- syscall.RtMsg
+ unix.RtMsg
}
func NewRtMsg() *RtMsg {
return &RtMsg{
- RtMsg: syscall.RtMsg{
- Table: syscall.RT_TABLE_MAIN,
- Scope: syscall.RT_SCOPE_UNIVERSE,
- Protocol: syscall.RTPROT_BOOT,
- Type: syscall.RTN_UNICAST,
+ RtMsg: unix.RtMsg{
+ Table: unix.RT_TABLE_MAIN,
+ Scope: unix.RT_SCOPE_UNIVERSE,
+ Protocol: unix.RTPROT_BOOT,
+ Type: unix.RTN_UNICAST,
},
}
}
func NewRtDelMsg() *RtMsg {
return &RtMsg{
- RtMsg: syscall.RtMsg{
- Table: syscall.RT_TABLE_MAIN,
- Scope: syscall.RT_SCOPE_NOWHERE,
+ RtMsg: unix.RtMsg{
+ Table: unix.RT_TABLE_MAIN,
+ Scope: unix.RT_SCOPE_NOWHERE,
},
}
}
func (msg *RtMsg) Len() int {
- return syscall.SizeofRtMsg
+ return unix.SizeofRtMsg
}
func DeserializeRtMsg(b []byte) *RtMsg {
- return (*RtMsg)(unsafe.Pointer(&b[0:syscall.SizeofRtMsg][0]))
+ return (*RtMsg)(unsafe.Pointer(&b[0:unix.SizeofRtMsg][0]))
}
func (msg *RtMsg) Serialize() []byte {
- return (*(*[syscall.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:]
+ return (*(*[unix.SizeofRtMsg]byte)(unsafe.Pointer(msg)))[:]
}
type RtNexthop struct {
- syscall.RtNexthop
+ unix.RtNexthop
Children []NetlinkRequestData
}
func DeserializeRtNexthop(b []byte) *RtNexthop {
- return (*RtNexthop)(unsafe.Pointer(&b[0:syscall.SizeofRtNexthop][0]))
+ return (*RtNexthop)(unsafe.Pointer(&b[0:unix.SizeofRtNexthop][0]))
}
func (msg *RtNexthop) Len() int {
if len(msg.Children) == 0 {
- return syscall.SizeofRtNexthop
+ return unix.SizeofRtNexthop
}
l := 0
for _, child := range msg.Children {
l += rtaAlignOf(child.Len())
}
- l += syscall.SizeofRtNexthop
+ l += unix.SizeofRtNexthop
return rtaAlignOf(l)
}
@@ -67,8 +68,8 @@ func (msg *RtNexthop) Serialize() []byte {
length := msg.Len()
msg.RtNexthop.Len = uint16(length)
buf := make([]byte, length)
- copy(buf, (*(*[syscall.SizeofRtNexthop]byte)(unsafe.Pointer(msg)))[:])
- next := rtaAlignOf(syscall.SizeofRtNexthop)
+ copy(buf, (*(*[unix.SizeofRtNexthop]byte)(unsafe.Pointer(msg)))[:])
+ next := rtaAlignOf(unix.SizeofRtNexthop)
if len(msg.Children) > 0 {
for _, child := range msg.Children {
childBuf := child.Serialize()