mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Don't allow exceeding maximum MTU for a given platform
This commit is contained in:
parent
7c0102e43d
commit
bec898a326
6 changed files with 46 additions and 5 deletions
|
@ -27,6 +27,17 @@ type tunDevice struct {
|
|||
iface tunInterface
|
||||
}
|
||||
|
||||
type tunDefaultParameters struct {
|
||||
maxMTU int
|
||||
}
|
||||
|
||||
func getMTUFromMax(mtu int) int {
|
||||
if mtu > defaultTUNParameters().maxMTU {
|
||||
return defaultTUNParameters().maxMTU
|
||||
}
|
||||
return mtu
|
||||
}
|
||||
|
||||
func (tun *tunDevice) init(core *Core) {
|
||||
tun.core = core
|
||||
tun.icmpv6.init(tun)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue