tailscale/wgengine/magicsock
Brad Fitzpatrick 0b1b2e5ed5 wgengine/magicsock: fix Conn.Rebind race that let ErrClosed errors be read
There was a logical race where Conn.Rebind could acquire the
RebindingUDPConn mutex, close the connection, fail to rebind, release
the mutex, and then because the mutex was no longer held, ReceiveIPv4
wouldn't retry reads that failed with net.ErrClosed, letting that
error back to wireguard-go, which would then stop running that receive
IP goroutine.

Instead, keep the RebindingUDPConn mutex held for the entirety of the
replacement in all cases.

Updates tailscale/corp#1289

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 387e83c8fe)
2021-03-12 20:48:17 -08:00
..
discopingpurpose_string.go wgengine/magicsock: make discoPingPurpose a stringer 2020-09-14 14:29:28 -07:00
legacy.go wgengine/magicsock: make legacy DstToString match Addrs 2021-01-20 10:31:51 -08:00
magicsock.go wgengine/magicsock: fix Conn.Rebind race that let ErrClosed errors be read 2021-03-12 20:48:17 -08:00
magicsock_test.go wgengine/magicsock: fix Conn.Rebind race that let ErrClosed errors be read 2021-03-12 20:48:17 -08:00