mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Fix setting up of MTU when value is outside of acceptable bounds, also account for ethernet headers in calculations, notify about clipping to stdout
This commit is contained in:
parent
17a711ab8a
commit
f49d9de421
6 changed files with 32 additions and 16 deletions
|
@ -18,7 +18,8 @@ import (
|
|||
// Configures the "utun" adapter with the correct IPv6 address and MTU.
|
||||
func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
if iftapmode {
|
||||
tun.log.Warnln("TAP mode is not supported on this platform, defaulting to TUN")
|
||||
tun.log.Warnln("Warning: TAP mode is not supported on this platform, defaulting to TUN")
|
||||
iftapmode = false
|
||||
}
|
||||
config := water.Config{DeviceType: water.TUN}
|
||||
iface, err := water.New(config)
|
||||
|
@ -26,7 +27,7 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
|
|||
panic(err)
|
||||
}
|
||||
tun.iface = iface
|
||||
tun.mtu = getSupportedMTU(mtu)
|
||||
tun.mtu = getSupportedMTU(mtu, iftapmode)
|
||||
return tun.setupAddress(addr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue