Fix integer conversions
This commit is contained in:
parent
7038de95e1
commit
b4cef2524f
5 changed files with 8 additions and 29 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue