From 7996ae7ccf284718fc98f5ba34c94b044b858ec2 Mon Sep 17 00:00:00 2001 From: Brian Geffon Date: Wed, 23 May 2018 15:00:59 -0700 Subject: Adding test case for RST acceptable ack panic PiperOrigin-RevId: 197795613 Change-Id: I759dd04995d900cba6b984649fa48bbc880946d6 --- pkg/tcpip/transport/tcp/tcp_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'pkg/tcpip') diff --git a/pkg/tcpip/transport/tcp/tcp_test.go b/pkg/tcpip/transport/tcp/tcp_test.go index 3c21a1ec3..8c54310f2 100644 --- a/pkg/tcpip/transport/tcp/tcp_test.go +++ b/pkg/tcpip/transport/tcp/tcp_test.go @@ -400,7 +400,20 @@ func TestRstOnCloseWithUnreadData(t *testing.T) { checker.TCP( checker.DstPort(context.TestPort), checker.TCPFlags(header.TCPFlagAck|header.TCPFlagRst), + // We shouldn't consume a sequence number on RST. + checker.SeqNum(uint32(c.IRS)+1), )) + + // This final should be ignored because an ACK on a reset doesn't + // mean anything. + c.SendPacket(nil, &context.Headers{ + SrcPort: context.TestPort, + DstPort: c.Port, + Flags: header.TCPFlagAck, + SeqNum: seqnum.Value(790 + len(data)), + AckNum: c.IRS.Add(seqnum.Size(2)), + RcvWnd: 30000, + }) } func TestFullWindowReceive(t *testing.T) { -- cgit v1.2.3