You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/wgengine/magicsock
Josh Bleecher Snyder b3d6704aa3 wgengine/magicsock: fix data race on endpoint.discoKey
endpoint.discoKey is protected by endpoint.mu.
endpoint.sendDiscoMessage was reading it without holding the lock.
This showed up in a CI failure and is readily reproducible locally.

The fix is in two parts.

First, for Conn.enqueueCallMeMaybe, eliminate the one-line helper method endpoint.sendDiscoMessage; call Conn.sendDiscoMessage directly.
This makes it more natural to read endpoint.discoKey in a context
in which endpoint.mu is already held.

Second, for endpoint.sendDiscoPing, explicitly pass the disco key
as an argument. Again, this makes it easier to read endpoint.discoKey
in a context in which endpoint.mu is already held.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
3 years ago
..
debugknobs.go wgengine/magicsock: remove unused debug knob. 3 years ago
debugknobs_ios.go wgengine/magicsock: remove unused debug knob. 3 years ago
discopingpurpose_string.go wgengine/magicsock: make discoPingPurpose a stringer 4 years ago
magicsock.go wgengine/magicsock: fix data race on endpoint.discoKey 3 years ago
magicsock_test.go wgengine/magicsock: add a stress test 3 years ago