wgengine/magicksock: clear LastTSMPDiscoAdvertisement when rotating disco keys

Updates #12639

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
cmol/trigger_tsmp_disco_advert_via_disco
Claus Lensbøl 4 weeks ago
parent fe28d1b28e
commit 4d1067603d
No known key found for this signature in database
GPG Key ID: 060429CBEC62B1B4

@ -1243,7 +1243,8 @@ func (c *Conn) DiscoPublicKey() key.DiscoPublic {
// RotateDiscoKey generates a new discovery key pair and updates the connection
// to use it. This invalidates all existing disco sessions and will cause peers
// to re-establish discovery sessions with the new key.
// to re-establish discovery sessions with the new key. Addtionally, the
// lastTSMPDiscoAdvertisement on all endpoints is reset to 0.
//
// This is primarily for debugging and testing purposes, a future enhancement
// should provide a mechanism for seamless rotation by supporting short term use
@ -1264,6 +1265,9 @@ func (c *Conn) RotateDiscoKey() {
if connCtx != nil {
c.ReSTUN("disco-key-rotation")
}
for _, endpoint := range c.peerMap.byEpAddr {
endpoint.ep.lastTSMPDiscoAdvertisement = 0
}
}
// determineEndpoints returns the machine's endpoint addresses. It does a STUN

Loading…
Cancel
Save