diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 17:27:18 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-05-21 18:48:48 +0200 |
commit | ff3f2455e5cd74bd45c2f124a1d275462e33a4a0 (patch) | |
tree | c201e712664d808f8b166f9ac74f78dbfbcbb76a /tun_darwin.go | |
parent | b962d7d791bb13830d62d7ae326780b413463971 (diff) |
Rework freebsd support
Diffstat (limited to 'tun_darwin.go')
-rw-r--r-- | tun_darwin.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tun_darwin.go b/tun_darwin.go index b8afdfd..ef84967 100644 --- a/tun_darwin.go +++ b/tun_darwin.go @@ -34,8 +34,6 @@ type sockaddrCtl struct { scReserved [5]uint32 } -// NativeTun is a hack to work around the first 4 bytes "packet -// information" because there doesn't seem to be an IFF_NO_PI for darwin. type NativeTun struct { name string fd *os.File @@ -67,7 +65,7 @@ func (tun *NativeTun) RoutineRouteListener(tunIfindex int) { continue } - if data[3 /* type */] != 0xe /* RTM_IFINFO */ { + if data[3 /* type */] != unix.RTM_IFINFO { continue } ifindex := int(*(*uint16)(unsafe.Pointer(&data[12 /* ifindex */]))) @@ -347,7 +345,7 @@ func (tun *NativeTun) setMTU(n int) error { ) if errno != 0 { - return fmt.Errorf("Failed to set MTU on %s", tun.name) + return fmt.Errorf("failed to set MTU on %s", tun.name) } return nil @@ -380,7 +378,7 @@ func (tun *NativeTun) MTU() (int, error) { uintptr(unsafe.Pointer(&ifr[0])), ) if errno != 0 { - return 0, fmt.Errorf("Failed to get MTU on %s", tun.name) + return 0, fmt.Errorf("failed to get MTU on %s", tun.name) } // convert result to signed 32-bit int |