If a server receives a fresh SYN packet for a connection that is already established, what should it do?
I have already seen What will happen at server side if it received 2 SYN packet from the same client application?. The example there covers a different case: a server receiving a duplicate previous session SYN before the 'correct' SYN. In that case, the server SYNACK's the wrong session back to the client, which then RSTs the bad session.
The answer does briefly mention this alternative case, but doesn't cover the details:
If the SYN at line 6 had arrived before the RST, a more complex exchange might have occurred with RST's sent in both directions.
What exactly happens in that more complex case? Does the server reply with a RST immediately, or re-ack the existing session, or something else?
More specifically, what happens here:
TCP A TCP B
1. CLOSED LISTEN
2. SYN-SENT --> <SEQ=100><CTL=SYN> --> SYN-RECEIVED
3. SYN-SENT <-- <SEQ=400><ACK=101><CTL=SYN,ACK> <-- SYN-RECEIVED
4. ESTABLISHED --> <SEQ=101><ACK=401><CTL=ACK> --> ESTABLISHED
5. ... <SEQ=200><CTL=SYN> --> ???
???