magicsock: mute noisy expected peer mtu related error (#10870)

pull/10900/head
Claire Wang 4 months ago committed by GitHub
parent 62b056d677
commit 213d696db0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1317,7 +1317,7 @@ func (c *Conn) sendDiscoMessage(dst netip.AddrPort, dstKey key.NodePublic, dstDi
} else if err == nil {
// Can't send. (e.g. no IPv6 locally)
} else {
if !c.networkDown() {
if !c.networkDown() && pmtuShouldLogDiscoTxErr(m, err) {
c.logf("magicsock: disco: failed to send %v to %v: %v", disco.MessageSummary(m), dst, err)
}
}

@ -5,7 +5,13 @@
package magicsock
import "tailscale.com/net/tstun"
import (
"errors"
"golang.org/x/sys/unix"
"tailscale.com/disco"
"tailscale.com/net/tstun"
)
// Peer path MTU routines shared by platforms that implement it.
@ -110,3 +116,15 @@ func (c *Conn) UpdatePMTUD() {
c.peerMTUEnabled.Store(newStatus)
c.resetEndpointStates()
}
var errEMSGSIZE error = unix.EMSGSIZE
func pmtuShouldLogDiscoTxErr(m disco.Message, err error) bool {
// Large disco.Ping packets used to probe path MTU may result in
// an EMSGSIZE error fairly regularly which can pollute logs.
p, ok := m.(*disco.Ping)
if !ok || p.Padding == 0 || !errors.Is(err, errEMSGSIZE) || debugPMTUD() {
return true
}
return false
}

@ -5,6 +5,8 @@
package magicsock
import "tailscale.com/disco"
func (c *Conn) DontFragSetting() (bool, error) {
return false, nil
}
@ -19,3 +21,7 @@ func (c *Conn) PeerMTUEnabled() bool {
func (c *Conn) UpdatePMTUD() {
}
func pmtuShouldLogDiscoTxErr(m disco.Message, err error) bool {
return true
}

Loading…
Cancel
Save