summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2020-08-07 12:06:32 -0700
committerBrad Fitzpatrick <brad@danga.com>2020-08-07 12:16:12 -0700
commitc64a43a734f52a6dd4eb01e9bc72d4b49ae3c776 (patch)
treee8018490517fe298c8f3a1d089139a4ae2e8d2d1
parent9318b4758cb9ed7357c42045ea03d4a8f268db59 (diff)
downloadtailscale-c64a43a734f52a6dd4eb01e9bc72d4b49ae3c776.tar.xz
tailscale-c64a43a734f52a6dd4eb01e9bc72d4b49ae3c776.zip
wgengine/router: set MTU on Windows to min(configured,possible)
Fixes tailscale/corp#542 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r--wgengine/router/ifconfig_windows.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/wgengine/router/ifconfig_windows.go b/wgengine/router/ifconfig_windows.go
index a9b99b89b..78388ccc0 100644
--- a/wgengine/router/ifconfig_windows.go
+++ b/wgengine/router/ifconfig_windows.go
@@ -121,6 +121,13 @@ func monitorDefaultRoutes(device *device.Device, autoMTU bool, tun *tun.NativeTu
return err
}
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 {
iface.NlMtu = 576
}