diff options
| author | Avery Pennarun <apenwarr@tailscale.com> | 2026-04-15 00:54:01 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2026-04-14 18:08:47 -0700 |
| commit | effbe67fe3e30f48bd4b159ca9d37b1afea6052a (patch) | |
| tree | 830089ce53273cb4f82945bb72b33c126d88bb68 /control/controlhttp/controlhttpserver | |
| parent | 6301a6ce4b7b98fcf76d673b2ed74d156d4fc48a (diff) | |
| download | tailscale-effbe67fe3e30f48bd4b159ca9d37b1afea6052a.tar.xz tailscale-effbe67fe3e30f48bd4b159ca9d37b1afea6052a.zip | |
wgengine/magicsock: remove pickPort, use port 0 to avoid TOCTOU race
pickPort would bind a UDP socket on :0 to get a free port, close
the socket, then hope to rebind to the same port in NewConn. This
is a TOCTOU race that can cause flaky test failures when another
process grabs the port in between.
Instead, pass Port: 0 to NewConn and let the OS assign the port
atomically, then read back the assigned port via conn.LocalPort().
Fixes #19409
Change-Id: Ie44b599fb93c361e29a05f2171ad747c46f82b7a
Co-authored-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver')
0 files changed, 0 insertions, 0 deletions
