summaryrefslogtreecommitdiffhomepage
path: root/tun_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'tun_darwin.go')
-rw-r--r--tun_darwin.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/tun_darwin.go b/tun_darwin.go
index 8e4b970..e5a01a7 100644
--- a/tun_darwin.go
+++ b/tun_darwin.go
@@ -380,11 +380,5 @@ func (tun *NativeTun) MTU() (int, error) {
return 0, fmt.Errorf("failed to get MTU on %s", tun.name)
}
- // convert result to signed 32-bit int
-
- val := binary.LittleEndian.Uint32(ifr[16:20])
- if val >= (1 << 31) {
- return int(val-(1<<31)) - (1 << 31), nil
- }
- return int(val), nil
+ return int(*(*int32)(unsafe.Pointer(&ifr[16]))), nil
}