wgengine/magicsock,tstest/natlab/vmtest: only send callMeMaybe with endpoints (#20088)

9be21088f4 changed sending disco pings so
a callMeMaybe would be not be gated by endpoints existing if the node
was running off of a cached netmap.

This commit partly reverts that change, but keeps in a few bug fixes in
that commit and the tests that was introduced and now skipped.

The behaviour prior to 9be21088f4 is
retained.

Updates #20085

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
Claus Lensbøl
2026-06-10 16:19:51 -04:00
committed by GitHub
parent e4ea65d32d
commit 2690d58e47
2 changed files with 15 additions and 8 deletions
+1 -8
View File
@@ -1388,19 +1388,12 @@ func (de *endpoint) sendDiscoPingsLocked(now mono.Time, sendCallMeMaybe bool) {
de.startDiscoPingLocked(epAddr{ap: ep}, now, pingDiscovery, 0, nil)
}
derpAddr := de.derpAddr
if sendCallMeMaybe && derpAddr.IsValid() && (sentAny || de.c.usingCachedNetmap.Load()) {
if sentAny && sendCallMeMaybe && derpAddr.IsValid() {
// Have our magicsock.Conn figure out its STUN endpoint (if
// it doesn't know already) and then send a CallMeMaybe
// message to our peer via DERP informing them that we've
// sent so our firewall ports are probably open and now
// would be a good time for them to connect.
//
// When working off of a cached netmap, send out a CallMeMaybe
// even if we don't know about any peer endpoints.
// Since we cannot rely on control to transfer endpoints for us,
// this makes establishing direct connections more reliable
// as the peer will respond with its own message and initiate
// the connection.
go de.c.enqueueCallMeMaybe(derpAddr, de)
}
}