summaryrefslogtreecommitdiffhomepage
path: root/tun_freebsd.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 18:33:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 18:35:52 +0200
commitb4cef2524f3b2be11f905c4114e2e747a8101160 (patch)
tree3bd95e4ce54c72edc8cbf5d0eb9cf7202048bebd /tun_freebsd.go
parent7038de95e119147245741c04feab25b833b615e9 (diff)
Fix integer conversions
Diffstat (limited to 'tun_freebsd.go')
-rw-r--r--tun_freebsd.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/tun_freebsd.go b/tun_freebsd.go
index dfd5d46..5461c45 100644
--- a/tun_freebsd.go
+++ b/tun_freebsd.go
@@ -515,11 +515,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
- mtu := ifr.MTU
- if mtu >= (1 << 31) {
- return int(mtu-(1<<31)) - (1 << 31), nil
- }
- return int(mtu), nil
-
+ return int(*(*int32)(unsafe.Pointer(&ifr.MTU))), nil
}