wgengine/magicsock: handle wireguard only clean up and log messages

This change updates log messaging when cleaning up wireguard only peers.
This change also stops us unnecessarily attempting to clean up disco
pings for wireguard only endpoints.

Updates #7826

Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
pull/10144/head
Charlotte Brandhorst-Satzkorn 1 year ago committed by Charlotte Brandhorst-Satzkorn
parent 3269b36bd0
commit 839fee9ef4

@ -1335,8 +1335,12 @@ func (de *endpoint) stopAndReset() {
defer de.mu.Unlock() defer de.mu.Unlock()
if closing := de.c.closing.Load(); !closing { if closing := de.c.closing.Load(); !closing {
if de.isWireguardOnly {
de.c.logf("[v1] magicsock: doing cleanup for wireguard key %s", de.publicKey.ShortString())
} else {
de.c.logf("[v1] magicsock: doing cleanup for discovery key %s", de.discoShort()) de.c.logf("[v1] magicsock: doing cleanup for discovery key %s", de.discoShort())
} }
}
de.debugUpdates.Add(EndpointChange{ de.debugUpdates.Add(EndpointChange{
When: time.Now(), When: time.Now(),
@ -1359,9 +1363,11 @@ func (de *endpoint) resetLocked() {
for _, es := range de.endpointState { for _, es := range de.endpointState {
es.lastPing = 0 es.lastPing = 0
} }
if !de.isWireguardOnly {
for txid, sp := range de.sentPing { for txid, sp := range de.sentPing {
de.removeSentDiscoPingLocked(txid, sp) de.removeSentDiscoPingLocked(txid, sp)
} }
}
} }
func (de *endpoint) numStopAndReset() int64 { func (de *endpoint) numStopAndReset() int64 {

Loading…
Cancel
Save