gvisor/pkg/tcpip/transport/tcp/BUILD

133 lines
3.0 KiB
Python
Raw Normal View History

load("//tools:defs.bzl", "go_library", "go_test")
load("//tools/go_generics:defs.bzl", "go_template_instance")
package(licenses = ["notice"])
go_template_instance(
name = "tcp_segment_list",
out = "tcp_segment_list.go",
package = "tcp",
prefix = "segment",
template = "//pkg/ilist:generic_list",
types = {
"Element": "*segment",
"Linker": "*segment",
},
)
go_template_instance(
name = "tcp_endpoint_list",
out = "tcp_endpoint_list.go",
package = "tcp",
prefix = "endpoint",
template = "//pkg/ilist:generic_list",
types = {
"Element": "*endpoint",
"Linker": "*endpoint",
},
)
go_library(
name = "tcp",
srcs = [
"accept.go",
"connect.go",
"connect_unsafe.go",
"cubic.go",
"cubic_state.go",
"dispatcher.go",
"endpoint.go",
"endpoint_state.go",
"forwarder.go",
"protocol.go",
"rack.go",
"rack_state.go",
"rcv.go",
"rcv_state.go",
"reno.go",
"sack.go",
"sack_scoreboard.go",
"segment.go",
"segment_heap.go",
"segment_queue.go",
"segment_state.go",
"segment_unsafe.go",
"snd.go",
"snd_state.go",
"tcp_endpoint_list.go",
"tcp_segment_list.go",
"timer.go",
],
imports = ["gvisor.dev/gvisor/pkg/tcpip/buffer"],
visibility = ["//visibility:public"],
deps = [
"//pkg/log",
"//pkg/rand",
"//pkg/sleep",
"//pkg/sync",
"//pkg/tcpip",
"//pkg/tcpip/buffer",
"//pkg/tcpip/hash/jenkins",
"//pkg/tcpip/header",
"//pkg/tcpip/header/parse",
"//pkg/tcpip/ports",
"//pkg/tcpip/seqnum",
"//pkg/tcpip/stack",
"//pkg/tcpip/transport/raw",
"//pkg/waiter",
"@com_github_google_btree//:go_default_library",
],
)
go_test(
name = "tcp_x_test",
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 17:45:26 +00:00
size = "medium",
srcs = [
"dual_stack_test.go",
"sack_scoreboard_test.go",
"tcp_noracedetector_test.go",
"tcp_rack_test.go",
"tcp_sack_test.go",
"tcp_test.go",
"tcp_timestamp_test.go",
],
shard_count = 10,
deps = [
":tcp",
"//pkg/rand",
"//pkg/sync",
"//pkg/tcpip",
"//pkg/tcpip/buffer",
"//pkg/tcpip/checker",
"//pkg/tcpip/header",
"//pkg/tcpip/link/loopback",
"//pkg/tcpip/link/sniffer",
"//pkg/tcpip/network/ipv4",
"//pkg/tcpip/network/ipv6",
"//pkg/tcpip/ports",
"//pkg/tcpip/seqnum",
"//pkg/tcpip/stack",
"//pkg/tcpip/transport/tcp/testing/context",
"//pkg/test/testutil",
"//pkg/waiter",
],
)
go_test(
name = "rcv_test",
size = "small",
srcs = ["rcv_test.go"],
deps = [
"//pkg/tcpip/header",
"//pkg/tcpip/seqnum",
],
)
go_test(
name = "tcp_test",
size = "small",
srcs = ["timer_test.go"],
library = ":tcp",
deps = ["//pkg/sleep"],
)