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 <[email protected]>
This commit is contained in:
toppk authored and GitHub committed 2026-10-13 15:32:58 -07:00
1 parent 40d0abcffb
commit 8b94ec2d96
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -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)
}
}
+2 -2
View File
@@ -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)
}