From 26419d5e5d02adbb05c50a96115d70fe88a347e5 Mon Sep 17 00:00:00 2001
From: Shivansh Rai <shivanshrai84@gmail.com>
Date: Fri, 25 Mar 2016 05:33:56 +0600
Subject: [PATCH] Test for behavior when sending a packet with both SYN and RST
 bits set

---
 .../tcp/listen/listen-incoming-syn-rst.pkt    | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 gtests/net/packetdrill/tests/bsd/tcp/listen/listen-incoming-syn-rst.pkt

diff --git a/gtests/net/packetdrill/tests/bsd/tcp/listen/listen-incoming-syn-rst.pkt b/gtests/net/packetdrill/tests/bsd/tcp/listen/listen-incoming-syn-rst.pkt
new file mode 100644
index 00000000..5e19c8ca
--- /dev/null
+++ b/gtests/net/packetdrill/tests/bsd/tcp/listen/listen-incoming-syn-rst.pkt
@@ -0,0 +1,22 @@
+// Test behavior when a listener gets an incoming packet that has
+// the SYN and RST bits set.
+
+0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.000 bind(3, ..., ...) = 0
+0.000 listen(3, 1) = 0
+
+0.100 < SR 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7>
+
+// The TCP stack should not respond to incoming RSTs, or else
+// we could get infinite RST ping-pong storms.
+
+// Now make sure that when a valid SYN arrives shortly thereafter
+// (with the same address 4-tuple) we can still successfully establish
+// a connection.
+
+0.200 < S 0:0(0) win 65535 <mss 1460,sackOK,nop,nop,nop,wscale 7>
+0.200 > S. 0:0(0) ack 1 <...>
+
+0.300 < . 1:1(0) ack 1 win 65535
+0.300 accept(3, ..., ...) = 4
-- 
GitLab