mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
limit MTU to no more than what the packetconn claims to support
This commit is contained in:
parent
3bfd891fd4
commit
b48962a69a
3 changed files with 11 additions and 3 deletions
|
@ -156,10 +156,14 @@ func (tun *TunAdapter) _start() error {
|
|||
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
|
||||
return nil
|
||||
}
|
||||
if err := tun.setup(current.IfName, addr, current.IfMTU); err != nil {
|
||||
mtu := current.IfMTU
|
||||
if tun.core.MTU() < uint64(mtu) {
|
||||
mtu = MTU(tun.core.MTU())
|
||||
}
|
||||
if err := tun.setup(current.IfName, addr, mtu); err != nil {
|
||||
return err
|
||||
}
|
||||
if tun.MTU() != current.IfMTU {
|
||||
if tun.MTU() != mtu {
|
||||
tun.log.Warnf("Warning: Interface MTU %d automatically adjusted to %d (supported range is 1280-%d)", current.IfMTU, tun.MTU(), MaximumMTU())
|
||||
}
|
||||
// TODO tun.core.SetMaximumSessionMTU(tun.MTU())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue