mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Fix couple of issues with MTU calculations
This commit is contained in:
parent
ec46b217da
commit
9fca3640f9
2 changed files with 7 additions and 20 deletions
|
@ -27,14 +27,6 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
|
|||
}
|
||||
tun.iface = iface
|
||||
tun.mtu = getSupportedMTU(mtu, iftapmode)
|
||||
// The following check is specific to Linux, as the TAP driver only supports
|
||||
// an MTU of 65535-14 to make room for the ethernet headers. This makes sure
|
||||
// that the MTU gets rounded down to 65521 instead of causing a panic.
|
||||
if iftapmode {
|
||||
if tun.mtu > 65535-tun_ETHER_HEADER_LENGTH {
|
||||
tun.mtu = 65535 - tun_ETHER_HEADER_LENGTH
|
||||
}
|
||||
}
|
||||
// Friendly output
|
||||
tun.log.Infof("Interface name: %s", tun.iface.Name())
|
||||
tun.log.Infof("Interface IPv6: %s", addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue