Convert syscall.AF_INET to FAMILY_V4

This commit is contained in:
Vishvananda Ishaya 2014-09-17 09:33:53 -07:00
parent 349cca1850
commit c84dba1b12
2 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package netlink
import (
"syscall"
"testing"
)
@ -23,7 +22,7 @@ func TestAddrAddDel(t *testing.T) {
t.Fatal(err)
}
addrs, err := AddrList(link, syscall.AF_INET)
addrs, err := AddrList(link, FAMILY_ALL)
if err != nil {
t.Fatal(err)
}
@ -35,7 +34,7 @@ func TestAddrAddDel(t *testing.T) {
if err = AddrDel(link, addr); err != nil {
t.Fatal(err)
}
addrs, err = AddrList(link, syscall.AF_INET)
addrs, err = AddrList(link, FAMILY_ALL)
if err != nil {
t.Fatal(err)
}

View File

@ -66,7 +66,7 @@ func routeHandle(route *Route, req *NetlinkRequest) error {
dstFamily := GetIPFamily(route.Dst.IP)
family = dstFamily
var dstData []byte
if dstFamily == syscall.AF_INET {
if dstFamily == FAMILY_V4 {
dstData = route.Dst.IP.To4()
} else {
dstData = route.Dst.IP.To16()
@ -81,7 +81,7 @@ func routeHandle(route *Route, req *NetlinkRequest) error {
}
family = srcFamily
var srcData []byte
if srcFamily == syscall.AF_INET {
if srcFamily == FAMILY_V4 {
srcData = route.Src.To4()
} else {
srcData = route.Src.To16()
@ -97,7 +97,7 @@ func routeHandle(route *Route, req *NetlinkRequest) error {
}
family = gwFamily
var gwData []byte
if gwFamily == syscall.AF_INET {
if gwFamily == FAMILY_V4 {
gwData = route.Gw.To4()
} else {
gwData = route.Gw.To16()