mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-15 10:49:18 +00:00
net/netcheck: use DERP frames as a signal for home region liveness
This uses the fact that we've received a frame from a given DERP region within a certain time as a signal that the region is stil present (and thus can still be a node's PreferredDERP / home region) even if we don't get a STUN response from that region during a netcheck. This should help avoid DERP flaps that occur due to losing STUN probes while still having a valid and active TCP connection to the DERP server. RELNOTE=Reduce home DERP flapping when there's still an active connection Updates #8603 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: If7da6312581e1d434d5c0811697319c621e187a0
This commit is contained in:
@@ -628,7 +628,17 @@ func (c *Conn) updateNetInfo(ctx context.Context) (*netcheck.Report, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
report, err := c.netChecker.GetReport(ctx, dm)
|
||||
report, err := c.netChecker.GetReport(ctx, dm, &netcheck.GetReportOpts{
|
||||
// Pass information about the last time that we received a
|
||||
// frame from a DERP server to our netchecker to help avoid
|
||||
// flapping the home region while there's still active
|
||||
// communication.
|
||||
//
|
||||
// NOTE(andrew-d): I don't love that we're depending on the
|
||||
// health package here, but I'd rather do that and not store
|
||||
// the exact same state in two different places.
|
||||
GetLastDERPActivity: health.GetDERPRegionReceivedTime,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user