gvisor/pkg/tcpip/ports
Bhasker Hariharan 570ca57180 Fix bug with TCP bind w/ SO_REUSEADDR.
In gVisor today its possible that when trying to bind a TCP socket
w/ SO_REUSEADDR specified and requesting the kernel pick a port by
setting port to zero can result in a previously bound port being
returned. This behaviour is incorrect as the user is clearly requesting
a free port. The behaviour is fine when the user explicity specifies
a port.

This change now checks if the user specified a port when making a port
reservation for a TCP port and only returns unbound ports even if
SO_REUSEADDR was specified.

Fixes #6209

PiperOrigin-RevId: 382607638
2021-07-01 14:42:00 -07:00
..
BUILD Fix bug with TCP bind w/ SO_REUSEADDR. 2021-07-01 14:42:00 -07:00
flags.go improve readability of ports package 2021-03-11 21:05:32 -08:00
ports.go Fix bug with TCP bind w/ SO_REUSEADDR. 2021-07-01 14:42:00 -07:00
ports_test.go Use the stack RNG everywhere 2021-05-26 18:15:43 -07:00