mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine/magicsock: fix de-dup disco ping handling for netmap endpoints (#7118)
Fixes #7116 Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
parent
01e736e1d5
commit
39e52c4b0a
@ -3747,10 +3747,10 @@ type endpointState struct {
|
||||
// updated and use it to discard old candidates.
|
||||
lastGotPing time.Time
|
||||
|
||||
// lastGotPingTxID, if lastGotPing is non-zero, contains the TxID for the
|
||||
// last incoming ping. This is used to de-dup incoming pings that we may
|
||||
// see on both the raw disco socket on Linux, and UDP socket. We cannot rely
|
||||
// solely on the raw socket disco handling due to https://github.com/tailscale/tailscale/issues/7078.
|
||||
// lastGotPingTxID contains the TxID for the last incoming ping. This is
|
||||
// used to de-dup incoming pings that we may see on both the raw disco
|
||||
// socket on Linux, and UDP socket. We cannot rely solely on the raw socket
|
||||
// disco handling due to https://github.com/tailscale/tailscale/issues/7078.
|
||||
lastGotPingTxID stun.TxID
|
||||
|
||||
// callMeMaybeTime, if non-zero, is the time this endpoint
|
||||
@ -4219,16 +4219,16 @@ func (de *endpoint) addCandidateEndpoint(ep netip.AddrPort, forRxPingTxID stun.T
|
||||
defer de.mu.Unlock()
|
||||
|
||||
if st, ok := de.endpointState[ep]; ok {
|
||||
duplicatePing = forRxPingTxID == st.lastGotPingTxID
|
||||
if !duplicatePing {
|
||||
st.lastGotPingTxID = forRxPingTxID
|
||||
}
|
||||
if st.lastGotPing.IsZero() {
|
||||
// Already-known endpoint from the network map.
|
||||
return false
|
||||
}
|
||||
if forRxPingTxID == st.lastGotPingTxID {
|
||||
return true
|
||||
return duplicatePing
|
||||
}
|
||||
st.lastGotPing = time.Now()
|
||||
st.lastGotPingTxID = forRxPingTxID
|
||||
return false
|
||||
return duplicatePing
|
||||
}
|
||||
|
||||
// Newly discovered endpoint. Exciting!
|
||||
|
Loading…
Reference in New Issue
Block a user