wgengine/netstack: make netstack MTU be 1280 also

Updates #3878

Change-Id: I1850085b32c8a40d85607b4ad433622c97d96a8d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/4755/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent 81487169f0
commit 1336fb740b

@ -0,0 +1,16 @@
// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package tstun
// DefaultMTU is the Tailscale default MTU for now.
//
// wireguard-go defaults to 1420 bytes, which only works if the
// "outer" MTU is 1500 bytes. This breaks on DSL connections
// (typically 1492 MTU) and on GCE (1460 MTU?!).
//
// 1280 is the smallest MTU allowed for IPv6, which is a sensible
// "probably works everywhere" setting until we develop proper PMTU
// discovery.
const DefaultMTU = 1280

@ -20,15 +20,7 @@ import (
"tailscale.com/types/logger" "tailscale.com/types/logger"
) )
// tunMTU is the MTU we set on tailscale's TUN interface. wireguard-go var tunMTU = DefaultMTU
// defaults to 1420 bytes, which only works if the "outer" MTU is 1500
// bytes. This breaks on DSL connections (typically 1492 MTU) and on
// GCE (1460 MTU?!).
//
// 1280 is the smallest MTU allowed for IPv6, which is a sensible
// "probably works everywhere" setting until we develop proper PMTU
// discovery.
var tunMTU = 1280
func init() { func init() {
if mtu, ok := envknob.LookupInt("TS_DEBUG_MTU"); ok { if mtu, ok := envknob.LookupInt("TS_DEBUG_MTU"); ok {

@ -131,7 +131,7 @@ type Impl struct {
var handleSSH func(logger.Logf, *ipnlocal.LocalBackend, net.Conn) error var handleSSH func(logger.Logf, *ipnlocal.LocalBackend, net.Conn) error
const nicID = 1 const nicID = 1
const mtu = 1500 const mtu = tstun.DefaultMTU
// Create creates and populates a new Impl. // Create creates and populates a new Impl.
func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager) (*Impl, error) { func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager) (*Impl, error) {
@ -1018,7 +1018,7 @@ func startPacketCopy(ctx context.Context, cancel context.CancelFunc, dst net.Pac
} }
go func() { go func() {
defer cancel() // tear down the other direction's copy defer cancel() // tear down the other direction's copy
pkt := make([]byte, mtu) pkt := make([]byte, 1500)
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():

Loading…
Cancel
Save