wgengine/magicsock: fix pong handling 'EndpointChange' reporting (#16018)

Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited 2025-05-19 11:42:13 -07:00 committed by GitHub
parent 8009ad74a3
commit 87a4f17883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -552,7 +552,7 @@ func (de *endpoint) addrForSendLocked(now mono.Time) (udpAddr, derpAddr netip.Ad
// addrForWireGuardSendLocked returns the address that should be used for // addrForWireGuardSendLocked returns the address that should be used for
// sending the next packet. If a packet has never or not recently been sent to // sending the next packet. If a packet has never or not recently been sent to
// the endpoint, then a randomly selected address for the endpoint is returned, // the endpoint, then a randomly selected address for the endpoint is returned,
// as well as a bool indiciating that WireGuard discovery pings should be started. // as well as a bool indicating that WireGuard discovery pings should be started.
// If the addresses have latency information available, then the address with the // If the addresses have latency information available, then the address with the
// best latency is used. // best latency is used.
// //
@ -1261,7 +1261,7 @@ func (de *endpoint) sendDiscoPingsLocked(now mono.Time, sendCallMeMaybe bool) {
} }
// sendWireGuardOnlyPingsLocked evaluates all available addresses for // sendWireGuardOnlyPingsLocked evaluates all available addresses for
// a WireGuard only endpoint and initates an ICMP ping for useable // a WireGuard only endpoint and initiates an ICMP ping for useable
// addresses. // addresses.
func (de *endpoint) sendWireGuardOnlyPingsLocked(now mono.Time) { func (de *endpoint) sendWireGuardOnlyPingsLocked(now mono.Time) {
if runtime.GOOS == "js" { if runtime.GOOS == "js" {
@ -1629,7 +1629,7 @@ func (de *endpoint) handlePongConnLocked(m *disco.Pong, di *discoInfo, src netip
de.c.logf("magicsock: disco: node %v %v now using %v mtu=%v tx=%x", de.publicKey.ShortString(), de.discoShort(), sp.to, thisPong.wireMTU, m.TxID[:6]) de.c.logf("magicsock: disco: node %v %v now using %v mtu=%v tx=%x", de.publicKey.ShortString(), de.discoShort(), sp.to, thisPong.wireMTU, m.TxID[:6])
de.debugUpdates.Add(EndpointChange{ de.debugUpdates.Add(EndpointChange{
When: time.Now(), When: time.Now(),
What: "handlePingLocked-bestAddr-update", What: "handlePongConnLocked-bestAddr-update",
From: de.bestAddr, From: de.bestAddr,
To: thisPong, To: thisPong,
}) })
@ -1638,7 +1638,7 @@ func (de *endpoint) handlePongConnLocked(m *disco.Pong, di *discoInfo, src netip
if de.bestAddr.AddrPort == thisPong.AddrPort { if de.bestAddr.AddrPort == thisPong.AddrPort {
de.debugUpdates.Add(EndpointChange{ de.debugUpdates.Add(EndpointChange{
When: time.Now(), When: time.Now(),
What: "handlePingLocked-bestAddr-latency", What: "handlePongConnLocked-bestAddr-latency",
From: de.bestAddr, From: de.bestAddr,
To: thisPong, To: thisPong,
}) })