Don't allow exceeding maximum MTU for a given platform

This commit is contained in:
Neil Alexander 2018-03-03 11:47:14 +00:00
parent 7c0102e43d
commit bec898a326
6 changed files with 46 additions and 5 deletions

View file

@ -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)