wgengine/router: set MTU on Windows to min(configured,possible)

Fixes tailscale/corp#542

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2020-08-07 12:06:32 -07:00 committed by Brad Fitzpatrick
parent 9318b4758c
commit c64a43a734

View File

@ -121,6 +121,13 @@ func monitorDefaultRoutes(device *device.Device, autoMTU bool, tun *tun.NativeTu
return err return err
} }
iface.NlMtu = mtu - 80 iface.NlMtu = mtu - 80
// If the TUN device was created with a smaller MTU,
// though, such as 1280, we don't want to go bigger than
// configured. (See the comment on minimalMTU in the
// wgengine package.)
if min, err := tun.MTU(); err == nil && min < int(iface.NlMtu) {
iface.NlMtu = uint32(min)
}
if iface.NlMtu < 576 { if iface.NlMtu < 576 {
iface.NlMtu = 576 iface.NlMtu = 576
} }