summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2018-05-22 15:51:55 -0700
committerShentubot <shentubot@google.com>2018-05-22 15:52:41 -0700
commit257ab8de93312295d475638498c57e4de77a4b02 (patch)
tree2e581e4114a1fa267b5c1ec1bfbe3bcdac0e7937
parent7b2b7a394601ae477538838702a2c5924da83751 (diff)
When sending a RST the acceptable ACK window shouldn't change.
Today when we transmit a RST it's happening during the time-wait flow. Because a FIN is allowed to advance the acceptable ACK window we're incorrectly doing that for a RST. PiperOrigin-RevId: 197637565 Change-Id: I080190b06bd0225326cd68c1fbf37bd3fdbd414e
-rw-r--r--pkg/tcpip/transport/tcp/snd.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/tcpip/transport/tcp/snd.go b/pkg/tcpip/transport/tcp/snd.go
index 6c363a929..95bea4d88 100644
--- a/pkg/tcpip/transport/tcp/snd.go
+++ b/pkg/tcpip/transport/tcp/snd.go
@@ -342,15 +342,17 @@ func (s *sender) sendData() {
s.ep.mu.Lock()
// We're sending a FIN by default
fl := flagFin
+ segEnd = seg.sequenceNumber
if (s.ep.shutdownFlags&tcpip.ShutdownRead) != 0 && rcvBufUsed > 0 {
// If there is unread data we must send a RST.
// For more information see RFC 2525 section 2.17.
fl = flagRst
+ } else {
+ segEnd = seg.sequenceNumber.Add(1)
}
+
s.ep.mu.Unlock()
seg.flags |= uint8(fl)
-
- segEnd = seg.sequenceNumber.Add(1)
} else {
// We're sending a non-FIN segment.
if !seg.sequenceNumber.LessThan(end) {