summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp
diff options
context:
space:
mode:
authorNayana Bidari <nybidari@google.com>2021-07-20 23:11:14 -0700
committergVisor bot <gvisor-bot@google.com>2021-07-20 23:15:05 -0700
commita4d743db59bc8c05d646ca3d5cd94498cf411d02 (patch)
treeafc29334e709194907b6b310dd226b0b3ec5c13e /pkg/tcpip/transport/tcp
parent9e805ce937ef2f2934e72f873ea4ae8451801c82 (diff)
Enable RACK by default in netstack.
PiperOrigin-RevId: 385944428
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r--pkg/tcpip/transport/tcp/endpoint.go5
-rw-r--r--pkg/tcpip/transport/tcp/protocol.go3
-rw-r--r--pkg/tcpip/transport/tcp/tcp_rack_test.go11
-rw-r--r--pkg/tcpip/transport/tcp/tcp_sack_test.go5
4 files changed, 12 insertions, 12 deletions
diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go
index ebc88d6c3..044123185 100644
--- a/pkg/tcpip/transport/tcp/endpoint.go
+++ b/pkg/tcpip/transport/tcp/endpoint.go
@@ -478,7 +478,7 @@ type endpoint struct {
// shutdownFlags represent the current shutdown state of the endpoint.
shutdownFlags tcpip.ShutdownFlags
- // tcpRecovery is the loss deteoction algorithm used by TCP.
+ // tcpRecovery is the loss recovery algorithm used by TCP.
tcpRecovery tcpip.TCPRecovery
// sack holds TCP SACK related information for this endpoint.
@@ -869,8 +869,6 @@ func newEndpoint(s *stack.Stack, netProto tcpip.NetworkProtocolNumber, waiterQue
e.maxSynRetries = uint8(synRetries)
}
- s.TransportProtocolOption(ProtocolNumber, &e.tcpRecovery)
-
if p := s.GetTCPProbe(); p != nil {
e.probe = p
}
@@ -2922,6 +2920,7 @@ func (e *endpoint) maybeEnableSACKPermitted(synOpts *header.TCPSynOptions) {
}
if bool(v) && synOpts.SACKPermitted {
e.SACKPermitted = true
+ e.stack.TransportProtocolOption(ProtocolNumber, &e.tcpRecovery)
}
}
diff --git a/pkg/tcpip/transport/tcp/protocol.go b/pkg/tcpip/transport/tcp/protocol.go
index 2fc282e73..18b834243 100644
--- a/pkg/tcpip/transport/tcp/protocol.go
+++ b/pkg/tcpip/transport/tcp/protocol.go
@@ -478,8 +478,7 @@ func NewProtocol(s *stack.Stack) stack.TransportProtocol {
minRTO: MinRTO,
maxRTO: MaxRTO,
maxRetries: MaxRetries,
- // TODO(gvisor.dev/issue/5243): Set recovery to tcpip.TCPRACKLossDetection.
- recovery: 0,
+ recovery: tcpip.TCPRACKLossDetection,
}
p.dispatcher.init(s.Rand(), runtime.GOMAXPROCS(0))
return &p
diff --git a/pkg/tcpip/transport/tcp/tcp_rack_test.go b/pkg/tcpip/transport/tcp/tcp_rack_test.go
index d6cf786a1..d826ff724 100644
--- a/pkg/tcpip/transport/tcp/tcp_rack_test.go
+++ b/pkg/tcpip/transport/tcp/tcp_rack_test.go
@@ -36,9 +36,9 @@ const (
latency = 5 * time.Millisecond
)
-func setStackRACKPermitted(t *testing.T, c *context.Context) {
+func setStackTCPRecovery(t *testing.T, c *context.Context, recovery int) {
t.Helper()
- opt := tcpip.TCPRACKLossDetection
+ opt := tcpip.TCPRecovery(recovery)
if err := c.Stack().SetTransportProtocolOption(header.TCPProtocolNumber, &opt); err != nil {
t.Fatalf("c.s.SetTransportProtocolOption(%d, &%v(%v)): %s", header.TCPProtocolNumber, opt, opt, err)
}
@@ -70,7 +70,6 @@ func TestRACKUpdate(t *testing.T) {
close(probeDone)
})
setStackSACKPermitted(t, c, true)
- setStackRACKPermitted(t, c)
createConnectedWithSACKAndTS(c)
data := make([]byte, maxPayload)
@@ -129,7 +128,6 @@ func TestRACKDetectReorder(t *testing.T) {
close(probeDone)
})
setStackSACKPermitted(t, c, true)
- setStackRACKPermitted(t, c)
createConnectedWithSACKAndTS(c)
data := make([]byte, ackNumToVerify*maxPayload)
for i := range data {
@@ -162,8 +160,8 @@ func TestRACKDetectReorder(t *testing.T) {
func sendAndReceiveWithSACK(t *testing.T, c *context.Context, numPackets int, enableRACK bool) []byte {
setStackSACKPermitted(t, c, true)
- if enableRACK {
- setStackRACKPermitted(t, c)
+ if !enableRACK {
+ setStackTCPRecovery(t, c, 0)
}
createConnectedWithSACKAndTS(c)
@@ -998,7 +996,6 @@ func TestRACKWithWindowFull(t *testing.T) {
defer c.Cleanup()
setStackSACKPermitted(t, c, true)
- setStackRACKPermitted(t, c)
createConnectedWithSACKAndTS(c)
seq := seqnum.Value(context.TestInitialSequenceNumber).Add(1)
diff --git a/pkg/tcpip/transport/tcp/tcp_sack_test.go b/pkg/tcpip/transport/tcp/tcp_sack_test.go
index 20c9761f2..83e0653b9 100644
--- a/pkg/tcpip/transport/tcp/tcp_sack_test.go
+++ b/pkg/tcpip/transport/tcp/tcp_sack_test.go
@@ -61,6 +61,7 @@ func TestSackPermittedConnect(t *testing.T) {
defer c.Cleanup()
setStackSACKPermitted(t, c, sackEnabled)
+ setStackTCPRecovery(t, c, 0)
rep := createConnectedWithSACKPermittedOption(c)
data := []byte{1, 2, 3}
@@ -105,6 +106,7 @@ func TestSackDisabledConnect(t *testing.T) {
defer c.Cleanup()
setStackSACKPermitted(t, c, sackEnabled)
+ setStackTCPRecovery(t, c, 0)
rep := c.CreateConnectedWithOptions(header.TCPSynOptions{})
@@ -166,6 +168,7 @@ func TestSackPermittedAccept(t *testing.T) {
}
}
setStackSACKPermitted(t, c, sackEnabled)
+ setStackTCPRecovery(t, c, 0)
rep := c.AcceptWithOptions(tc.wndScale, header.TCPSynOptions{MSS: defaultIPv4MSS, SACKPermitted: tc.sackPermitted})
// Now verify no SACK blocks are
@@ -239,6 +242,7 @@ func TestSackDisabledAccept(t *testing.T) {
}
setStackSACKPermitted(t, c, sackEnabled)
+ setStackTCPRecovery(t, c, 0)
rep := c.AcceptWithOptions(tc.wndScale, header.TCPSynOptions{MSS: defaultIPv4MSS})
@@ -386,6 +390,7 @@ func TestSACKRecovery(t *testing.T) {
log.Printf("state: %+v\n", s)
})
setStackSACKPermitted(t, c, true)
+ setStackTCPRecovery(t, c, 0)
createConnectedWithSACKAndTS(c)
const iterations = 3