gvisor/pkg/tcpip
Bhasker Hariharan 66ebb6575f Add support for TIME_WAIT timeout.
This change adds explicit support for honoring the 2MSL timeout
for sockets in TIME_WAIT state. It also adds support for the
TCP_LINGER2 option that allows modification of the FIN_WAIT2
state timeout duration for a given socket.

It also adds an option to modify the Stack wide TIME_WAIT timeout
but this is only for testing. On Linux this is fixed at 60s.

Further, we also now correctly process RST's in CLOSE_WAIT and
close the socket similar to linux without moving it to error
state.

We also now handle SYN in ESTABLISHED state as per
RFC5961#section-4.1. Earlier we would just drop these SYNs.
Which can result in some tests that pass on linux to fail on
gVisor.

Netstack now honors TIME_WAIT correctly as well as handles the
following cases correctly.

- TCP RSTs in TIME_WAIT are ignored.
- A duplicate TCP FIN during TIME_WAIT extends the TIME_WAIT
  and a dup ACK is sent in response to the FIN as the dup FIN
  indicates potential loss of the original final ACK.
- An out of order segment during TIME_WAIT generates a dup ACK.
- A new SYN w/ a sequence number > the highest sequence number
  in the previous connection closes the TIME_WAIT early and
  opens a new connection.

Further to make the SYN case work correctly the ISN (Initial
Sequence Number) generation for Netstack has been updated to
be as per RFC. Its not a pure random number anymore and follows
the recommendation in https://tools.ietf.org/html/rfc6528#page-3.

The current hash used is not a cryptographically secure hash
function. A separate change will update the hash function used
to Siphash similar to what is used in Linux.

PiperOrigin-RevId: 279106406
2019-11-07 09:46:55 -08:00
..
adapters/gonet Add support for TIME_WAIT timeout. 2019-11-07 09:46:55 -08:00
buffer netstack/tcp: software segmentation offload 2019-10-22 11:55:56 -07:00
checker Validate the checksum for incoming ICMPv6 packets 2019-10-25 16:06:55 -07:00
hash/jenkins Remove go_test from go_stateify and go_marshal 2019-09-12 15:10:17 -07:00
header Discover default routers from Router Advertisements 2019-11-06 16:29:58 -08:00
iptables Reorder BUILD license and load functions in netstack. 2019-10-14 15:21:59 -07:00
link Use PacketBuffers, rather than VectorisedViews, in netstack. 2019-11-06 14:25:59 -08:00
network Rename nicid to nicID to follow go-readability initialisms 2019-11-06 19:41:25 -08:00
ports Fix bugs in PickEphemeralPort for TCP. 2019-09-30 13:55:22 -07:00
sample Remove centralized registration of protocols. 2019-09-25 12:57:05 -07:00
seqnum Reorder BUILD license and load functions in netstack. 2019-10-14 15:21:59 -07:00
stack Add support for TIME_WAIT timeout. 2019-11-07 09:46:55 -08:00
transport Add support for TIME_WAIT timeout. 2019-11-07 09:46:55 -08:00
BUILD Use PacketBuffers, rather than VectorisedViews, in netstack. 2019-11-06 14:25:59 -08:00
packet_buffer.go Use PacketBuffers, rather than VectorisedViews, in netstack. 2019-11-06 14:25:59 -08:00
packet_buffer_state.go Use PacketBuffers, rather than VectorisedViews, in netstack. 2019-11-06 14:25:59 -08:00
tcpip.go Add support for TIME_WAIT timeout. 2019-11-07 09:46:55 -08:00
tcpip_test.go Implement proper local broadcast behavior 2019-10-03 19:31:35 -07:00
time.s Change copyright notice to "The gVisor Authors" 2019-04-29 14:26:23 -07:00
time_unsafe.go Update build tags to allow Go 1.14 2019-10-29 13:18:16 -07:00