From 8b94ec2d96e96f3d273e82bb67f6746cf8324447 Mon Sep 17 00:00:00 2001 From: toppk Date: Tue, 13 Oct 2026 15:32:58 -0700 Subject: [PATCH] wgengine/magicsock: log initial contacts at verbose level (#21766) Repeated CallMeMaybe messages over DERP can each log a new contact for the same peer, flooding stderr. Mark the DERP, direct, and control-netmap latency messages [v1] so they remain in diagnostic uploads but only reach stderr with --verbose=1. Updates #12639 Updates #21765 Change-Id: Ic7ee47c699e5698f61358a72c6fd7776e1caf8dc Signed-off-by: kenneth topp --- wgengine/magicsock/endpoint.go | 2 +- wgengine/magicsock/magicsock.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wgengine/magicsock/endpoint.go b/wgengine/magicsock/endpoint.go index 3f65b2ae6..823a702d1 100644 --- a/wgengine/magicsock/endpoint.go +++ b/wgengine/magicsock/endpoint.go @@ -150,7 +150,7 @@ func (de *endpoint) setBestAddrLocked(v addrQuality) { } // Regardless whether the netmap is cached, record how long it has // been since the endpoint was initialized. - de.c.logf("magicsock: new contact: peer=%s usec=%d cached=%v via=direct", + de.c.logf("[v1] magicsock: new contact: peer=%s usec=%d cached=%v via=direct", de.publicKey.ShortString(), int64(mono.Since(de.c.initializedAt)/time.Microsecond), isCached) } } diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index bcf552fc3..84de9fc7e 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -2405,7 +2405,7 @@ func (c *Conn) handleDiscoMessage(msg []byte, src epAddr, shouldBeRelayHandshake // If we did not already have an endpoint for this peer, even a stale // one, record how long it has been since the endpoint was initialized. if !lastBest.ap.IsValid() { - c.logf("magicsock: new contact: peer=%s usec=%d cached=%v via=derp", + c.logf("[v1] magicsock: new contact: peer=%s usec=%d cached=%v via=derp", nodeKey.ShortString(), int64(mono.Since(c.initializedAt)/time.Microsecond), isCached) } if isVia { @@ -3089,7 +3089,7 @@ func (c *Conn) setNetworkMapInternal(self tailcfg.NodeView, peers []tailcfg.Node if self.Valid() && !selfWasValid { // Reaching here, we have our first "real" netmap (self is valid, and // the previous netmap was unset or reset), so record the latency from reset. - c.logf("magicsock: new contact: control-netmap usec=%d cached=%v", + c.logf("[v1] magicsock: new contact: control-netmap usec=%d cached=%v", int64(mono.Since(initializedAt)/time.Microsecond), isCached) }