1
0
mirror of https://github.com/rancher/os.git synced 2025-07-08 12:28:37 +00:00
os/vendor/github.com/vishvananda/netlink/order.go
Sven Dowideit 17b3589782 Add a network test that sets up 2 of 4 ehternet devices, and allows another to use dhcp
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2017-03-10 22:28:41 +10:00

33 lines
535 B
Go

package netlink
import (
"encoding/binary"
"github.com/vishvananda/netlink/nl"
)
var (
native = nl.NativeEndian()
networkOrder = binary.BigEndian
)
func htonl(val uint32) []byte {
bytes := make([]byte, 4)
binary.BigEndian.PutUint32(bytes, val)
return bytes
}
func htons(val uint16) []byte {
bytes := make([]byte, 2)
binary.BigEndian.PutUint16(bytes, val)
return bytes
}
func ntohl(buf []byte) uint32 {
return binary.BigEndian.Uint32(buf)
}
func ntohs(buf []byte) uint16 {
return binary.BigEndian.Uint16(buf)
}