github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/packetdrill/no_rst_to_rst.pkt (about)

     1  // Test a RST is not generated in response to a RST and a RST is correctly
     2  // generated when an accepted endpoint is RST due to an incoming RST.
     3  
     4  0  socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
     5  +0 bind(3, ..., ...) = 0
     6  
     7  +0 listen(3, 1) = 0
     8  
     9  // Establish a connection without timestamps.
    10  +0 < S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7>
    11  +0 > S. 0:0(0) ack 1 <...>
    12  +0 < P. 1:1(0) ack 1 win 257
    13  
    14  +0.100 accept(3, ..., ...) = 4
    15  
    16  +0.200 < R 1:1(0) win 0
    17  
    18  +0.300 read(4,..., 4) = -1 ECONNRESET (Connection Reset by Peer)
    19  
    20  +0.00 < . 1:1(0) ack 1 win 257
    21  
    22  // Linux generates a reset with no ack number/bit set. This is contradictory to
    23  // what is specified in Rule 1 under Reset Generation in
    24  // https://tools.ietf.org/html/rfc793#section-3.4.
    25  //   "1. If the connection does not exist (CLOSED) then a reset is sent
    26  //    in response to any incoming segment except another reset.  In
    27  //    particular, SYNs addressed to a non-existent connection are rejected
    28  //    by this means.
    29  //
    30  //    If the incoming segment has an ACK field, the reset takes its
    31  //    sequence number from the ACK field of the segment, otherwise the
    32  //    reset has sequence number zero and the ACK field is set to the sum
    33  //    of the sequence number and segment length of the incoming segment.
    34  //    The connection remains in the CLOSED state."
    35  
    36  +0.00 > R 1:1(0) win 0