gvisor/pkg
Bhasker Hariharan 61f6fbd0ce Fix bugs in PickEphemeralPort for TCP.
Netstack always picks a random start point everytime PickEphemeralPort
is called. While this is required for UDP so that DNS requests go
out through a randomized set of ports it is not required for TCP. Infact
Linux explicitly hashes the (srcip, dstip, dstport) and a one time secret
initialized at start of the application to get a random offset. But to
ensure it doesn't start from the same point on every scan it uses a static
hint that is incremented by 2 in every call to pick ephemeral ports.

The reason for 2 is Linux seems to split the port ranges where active connects
seem to use even ones while odd ones are used by listening sockets.

This CL implements a similar strategy where we use a hash + hint to generate
the offset to start the search for a free Ephemeral port.

This ensures that we cycle through the available port space in order for
repeated connects to the same destination and significantly reduces the
chance of picking a recently released port.

PiperOrigin-RevId: 272058370
2019-09-30 13:55:22 -07:00
..
abi Signalfd support 2019-09-18 15:16:42 -07:00
amutex Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
atomicbitops Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
binary Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
bits Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
bpf Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
compressio Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
control Update canonical repository. 2019-06-13 16:50:15 -07:00
cpuid Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
eventchannel Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
fd Merge pull request #765 from trailofbits:uds_support 2019-09-25 16:44:22 -07:00
fdchannel Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
fdnotifier Change syscall.EPOLLET to unix.EPOLLET 2019-08-05 23:10:08 +00:00
flipcall Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
fspath Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
gate Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
ilist Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
linewriter Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
log Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
memutil Update canonical repository. 2019-06-13 16:50:15 -07:00
metric internal BUILD file cleanup. 2019-09-23 08:25:13 -07:00
p9 Add test for concurrent reads and writes. 2019-09-23 16:44:30 -07:00
procid Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
rand Update canonical repository. 2019-06-13 16:50:15 -07:00
refs Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
seccomp gvisor: change syscall.RawSyscall to syscall.RawSyscall6 where required 2019-09-24 23:47:42 -07:00
secio Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
segment Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
sentry Force timestamps to update when set via InodeOperations.SetTimestamps. 2019-09-30 13:08:45 -07:00
sleep Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
state Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
syserr netstack/udp: connect with the AF_UNSPEC address family means disconnect 2019-07-03 14:19:02 -07:00
syserror Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
tcpip Fix bugs in PickEphemeralPort for TCP. 2019-09-30 13:55:22 -07:00
tmutex Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
unet Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
urpc Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
waiter Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00