mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
Revert "wgengine,net,ipn,disco: split up and define different types of MTU"
This reverts commit 059051c58a
.
Signed-off-by: Val <valerie@tailscale.com>
This commit is contained in:
@@ -422,10 +422,6 @@ func (de *endpoint) noteActiveLocked() {
|
||||
}
|
||||
}
|
||||
|
||||
// MaxDiscoPingSize is the largest useful ping message size that we
|
||||
// can send - the maximum packet size minus the IPv4 and UDP headers.
|
||||
var MaxDiscoPingSize = tstun.MaxPacketSize - 20 - 8
|
||||
|
||||
// cliPing starts a ping for the "tailscale ping" command. res is value to call cb with,
|
||||
// already partially filled.
|
||||
func (de *endpoint) cliPing(res *ipnstate.PingResult, size int, cb func(*ipnstate.PingResult)) {
|
||||
@@ -437,11 +433,6 @@ func (de *endpoint) cliPing(res *ipnstate.PingResult, size int, cb func(*ipnstat
|
||||
cb(res)
|
||||
return
|
||||
}
|
||||
if size > MaxDiscoPingSize {
|
||||
res.Err = errPingTooBig.Error()
|
||||
cb(res)
|
||||
return
|
||||
}
|
||||
|
||||
now := mono.Now()
|
||||
udpAddr, derpAddr, _ := de.addrForSendLocked(now)
|
||||
@@ -466,7 +457,6 @@ func (de *endpoint) cliPing(res *ipnstate.PingResult, size int, cb func(*ipnstat
|
||||
var (
|
||||
errExpired = errors.New("peer's node key has expired")
|
||||
errNoUDPOrDERP = errors.New("no UDP or DERP addr")
|
||||
errPingTooBig = errors.New("ping size too big")
|
||||
)
|
||||
|
||||
func (de *endpoint) send(buffs [][]byte) error {
|
||||
@@ -574,9 +564,13 @@ const discoPingSize = len(disco.Magic) + key.DiscoPublicRawLen + disco.NonceLen
|
||||
// The caller should use de.discoKey as the discoKey argument.
|
||||
// It is passed in so that sendDiscoPing doesn't need to lock de.mu.
|
||||
func (de *endpoint) sendDiscoPing(ep netip.AddrPort, discoKey key.DiscoPublic, txid stun.TxID, size int, logLevel discoLogLevel) {
|
||||
size = min(size, MaxDiscoPingSize)
|
||||
padding := max(size-discoPingSize, 0)
|
||||
|
||||
padding := 0
|
||||
if size > int(tstun.DefaultMTU()) {
|
||||
size = int(tstun.DefaultMTU())
|
||||
}
|
||||
if size-discoPingSize > 0 {
|
||||
padding = size - discoPingSize
|
||||
}
|
||||
sent, _ := de.c.sendDiscoMessage(ep, de.publicKey, discoKey, &disco.Ping{
|
||||
TxID: [12]byte(txid),
|
||||
NodeKey: de.c.publicKeyAtomic.Load(),
|
||||
|
@@ -150,11 +150,10 @@ type Impl struct {
|
||||
|
||||
const nicID = 1
|
||||
|
||||
// maxUDPPacketSize is the maximum size of a UDP packet we copy in
|
||||
// startPacketCopy when relaying UDP packets. The user can configure
|
||||
// the tailscale MTU to anything up to this size so we can potentially
|
||||
// have a UDP packet as big as the MTU.
|
||||
const maxUDPPacketSize = tstun.MaxPacketSize
|
||||
// maxUDPPacketSize is the maximum size of a UDP packet we copy in startPacketCopy
|
||||
// when relaying UDP packets. We don't use the 'mtu' const in anticipation of
|
||||
// one day making the MTU more dynamic.
|
||||
const maxUDPPacketSize = 1500
|
||||
|
||||
// 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, pm *proxymap.Mapper) (*Impl, error) {
|
||||
@@ -185,7 +184,7 @@ func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magi
|
||||
if tcpipErr != nil {
|
||||
return nil, fmt.Errorf("could not enable TCP SACK: %v", tcpipErr)
|
||||
}
|
||||
linkEP := channel.New(512, uint32(tstun.DefaultTUNMTU()), "")
|
||||
linkEP := channel.New(512, tstun.DefaultMTU(), "")
|
||||
if tcpipProblem := ipstack.CreateNIC(nicID, linkEP); tcpipProblem != nil {
|
||||
return nil, fmt.Errorf("could not create netstack NIC: %v", tcpipProblem)
|
||||
}
|
||||
@@ -1060,9 +1059,7 @@ func (ns *Impl) acceptUDP(r *udp.ForwarderRequest) {
|
||||
go ns.forwardUDP(c, srcAddr, dstAddr)
|
||||
}
|
||||
|
||||
// Buffer pool for forwarding UDP packets. Implementations are advised not to
|
||||
// exceed 512 bytes per DNS request due to fragmenting but in reality can and do
|
||||
// send much larger packets, so use the maximum possible UDP packet size.
|
||||
// Buffer pool for forwarding UDP packets.
|
||||
var udpBufPool = &sync.Pool{
|
||||
New: func() any {
|
||||
b := make([]byte, maxUDPPacketSize)
|
||||
|
@@ -241,7 +241,7 @@ func interfaceFromLUID(luid winipcfg.LUID, flags winipcfg.GAAFlags) (*winipcfg.I
|
||||
var networkCategoryWarning = health.NewWarnable(health.WithMapDebugFlag("warn-network-category-unhealthy"))
|
||||
|
||||
func configureInterface(cfg *Config, tun *tun.NativeTun) (retErr error) {
|
||||
var mtu = tstun.DefaultTUNMTU()
|
||||
var mtu = tstun.DefaultMTU()
|
||||
luid := winipcfg.LUID(tun.LUID())
|
||||
iface, err := interfaceFromLUID(luid,
|
||||
// Issue 474: on early boot, when the network is still
|
||||
|
Reference in New Issue
Block a user