[Bug 217637] One TCP connection accepted TWO times

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Mar 19 18:49:17 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217637

--- Comment #36 from slw at zxy.spb.ru ---
(In reply to Michael Tuexen from comment #35)

> This doesn't happen because NEW data arrives and the application has called
close().
So this new data cannot be delivered to the application. The TCP stack has do
drop it. That is why a RST is sent and the connection is moved to CLOSED.

I mean in this case RST must send in sequence, w/ ACK set and ACKed recv data.
And don't moved to CLOSED.

RFC793:

"
3.5.  Closing a Connection

  CLOSE is an operation meaning "I have no more data to send."  The
  notion of closing a full-duplex connection is subject to ambiguous
  interpretation, of course, since it may not be obvious how to treat
  the receiving side of the connection.  We have chosen to treat CLOSE
  in a simplex fashion.  The user who CLOSEs may continue to RECEIVE
  until he is told that the other side has CLOSED also.  Thus, a program
  could initiate several SENDs followed by a CLOSE, and then continue to
  RECEIVE until signaled that a RECEIVE failed because the other side
  has CLOSED.  We assume that the TCP will signal a user, even if no
  RECEIVEs are outstanding, that the other side has closed, so the user
  can terminate his side gracefully.  A TCP will reliably deliver all
  buffers SENT before the connection was CLOSED so a user who expects no
  data in return need only wait to hear the connection was CLOSED
  successfully to know that all his data was received at the destination
  TCP.  Users must keep reading connections they close for sending until
  the TCP says no more data.

  Case 1:  Local user initiates the close

    In this case, a FIN segment can be constructed and placed on the
    outgoing segment queue.  No further SENDs from the user will be
    accepted by the TCP, and it enters the FIN-WAIT-1 state.  RECEIVEs
    are allowed in this state.  All segments preceding and including FIN
    will be retransmitted until acknowledged.  When the other TCP has
    both acknowledged the FIN and sent a FIN of its own, the first TCP
    can ACK this FIN.  Note that a TCP receiving a FIN will ACK but not
    send its own FIN until its user has CLOSED the connection also.
"

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-net mailing list