Skip to content

Conversation

@bradfitz
Copy link
Member

bradfitz added a commit to tailscale/tailscale that referenced this pull request Nov 12, 2025
Depends on tailscale/wireguard-go#47

Updates #17858

Change-Id: I3e38484bfc3e73b29cbe9e53f28f140c2cf85ae1
Signed-off-by: Brad Fitzpatrick <[email protected]>
@bradfitz bradfitz requested a review from raggi November 17, 2025 19:12
@bradfitz bradfitz marked this pull request as ready for review November 20, 2025 21:32
toRemove := peer.handshake.remoteStatic
go func() {
peer.device.RemovePeer(toRemove)
log.Printf("expiredZeroKeyMaterial: removed idle lazy peer %x", toRemove)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

peer.device.log.Verbosef, and we could match the overall signature to the above log message or close to it, i.e. use %s of peer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right!

peer.SendHandshakeInitiation(false)
}

func expiredZeroKeyMaterial(peer *Peer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should rename this "expirePeer" or similar

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I was trying to keep it closer to upstream

if slices.Equal(p.state.allowedIPs, allowedIPs) {
return
}
p.device.allowedips.SetPeerPrefixes(p, allowedIPs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the clone and comment below seem sensible, but if that implies a dependence or leads to a future dependence, SetPeerPrefixes doesn't document the same behavior that this method relies on - if we need to preserve the behavior we should document it so future changes are less likely to accidentally change the semnatics.

}
}

func (table *AllowedIPs) SetPeerPrefixes(peer *Peer, prefixes []netip.Prefix) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to need to hold this with care, and it's almost tempting to suggest fixing it wireguard-go side, though it's also sort of a pre-existing issue:

If Peer A and Peer B have the same routes, then the last write wins.

If Peer B is removed, the route becomes un-routed.

A typical user expectation would more likely be that Peer A becomes the destination instead.

I believe we do some guarding of this on our side at quite a distance away from here, but it feels risky.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I think I can unexport this now. I think this was from when I was waffling on the API I wanted. But this can be an internal detail now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants