SIGN IN SIGN UP

checklocks: initialize TCP IDs before publication

ICMP error delivery can read an endpoint's ID as soon as it is in the
transport registry, without taking the endpoint mutex. Initialize the
local port before registration instead of replacing the ID afterward.
Restore the old ID if registration fails.

Extend the existing connect-error test to deliver ICMP after registry
publication but before the handshake proceeds. The registry is the only
publication barrier, so the test exposes the old ID write under the race
detector without ordering that write before the reader.

Assisted-by: Codex
T
Tamir Duberstein committed
835ec556aefe61ca5a9301ac7992e1b23925298d
Parent: 3c5eee1