summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp/connect.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2019-02-11 10:22:42 -0800
committerShentubot <shentubot@google.com>2019-02-11 10:23:43 -0800
commitefe5e737d7da48e6f99a1d9a53fe04b6d21b7511 (patch)
tree0709c0e8448a08c8ee361cf4ad961c10f8eea25b /pkg/tcpip/transport/tcp/connect.go
parent85d53d81d9f544277e3e86f83558cbc008ff7adb (diff)
Do not drop packets w/ missing TCP timestamps.
RFC7323 recommends that if the timestamp option was negotiated then all packets should carry a TCP Timestamp and any packets that do not should be dropped. Netstack implemented this behaviour. Linux OTOH does not and will accept such packets. This change makes Netstack behaviour compatible with Linux. Also now that we allow such packets, we do need to update RTO calculations based on these packets even if timestamp option is enabled. PiperOrigin-RevId: 233432268 Change-Id: I9f4742ae6b63930ac3b5e37d8c238761e6a4b29f
Diffstat (limited to 'pkg/tcpip/transport/tcp/connect.go')
-rw-r--r--pkg/tcpip/transport/tcp/connect.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/pkg/tcpip/transport/tcp/connect.go b/pkg/tcpip/transport/tcp/connect.go
index cc34e74b2..7b80f7519 100644
--- a/pkg/tcpip/transport/tcp/connect.go
+++ b/pkg/tcpip/transport/tcp/connect.go
@@ -289,8 +289,9 @@ func (h *handshake) synRcvdState(s *segment) *tcpip.Error {
}
// Update timestamp if required. See RFC7323, section-4.3.
- h.ep.updateRecentTimestamp(s.parsedOptions.TSVal, h.ackNum, s.sequenceNumber)
-
+ if h.ep.sendTSOk && s.parsedOptions.TS {
+ h.ep.updateRecentTimestamp(s.parsedOptions.TSVal, h.ackNum, s.sequenceNumber)
+ }
h.state = handshakeCompleted
return nil
}
@@ -740,16 +741,6 @@ func (e *endpoint) handleSegments() *tcpip.Error {
// send window scale.
s.window <<= e.snd.sndWndScale
- // If the timestamp option is negotiated and the segment
- // does not carry a timestamp option then the segment
- // must be dropped as per
- // https://tools.ietf.org/html/rfc7323#section-3.2.
- if e.sendTSOk && !s.parsedOptions.TS {
- e.stack.Stats().DroppedPackets.Increment()
- s.decRef()
- continue
- }
-
// RFC 793, page 41 states that "once in the ESTABLISHED
// state all segments must carry current acknowledgment
// information."