mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-09 12:14:05 +00:00
Don't allow exceeding maximum MTU for a given platform
This commit is contained in:
@ -7,6 +7,12 @@ import water "github.com/neilalexander/water"
|
||||
// This is to catch unsupported platforms
|
||||
// If your platform supports tun devices, you could try configuring it manually
|
||||
|
||||
func defaultTUNParameters() tunDefaultParameters {
|
||||
return tunDefaultParameters{
|
||||
maxMTU: 65535,
|
||||
}
|
||||
}
|
||||
|
||||
func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
var config water.Config
|
||||
if iftapmode {
|
||||
@ -19,7 +25,7 @@ func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int)
|
||||
panic(err)
|
||||
}
|
||||
tun.iface = iface
|
||||
tun.mtu = mtu //1280 // Lets default to the smallest thing allowed for now
|
||||
tun.mtu = getMTUFromMax(mtu)
|
||||
return tun.setupAddress(addr)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user