Orderly TCP connection lifetime

This figure documents the historical i386 source baseline. Current native x86-64/AArch64 qualification is recorded separately; this is not an ELF64 or native SMP implementation diagram.

Orderly TCP connection lifetime An active open reaches SYN_SENT and accepts SYN+ACK; a listener creates a SYN_RECEIVED child and accepts ACK. Both reach ESTABLISHED. Local close passes FIN_WAIT_1 and FIN_WAIT_2, while peer-first close passes CLOSE_WAIT and LAST_ACK. Simultaneous close may use CLOSING; TIME_WAIT expires after 200 ticks. Resets, retries and cleanup are omitted; FIN_WAIT_2 also has a bounded timeout. Main orderly paths · resets, retries, and error cleanup omitted. FIN_WAIT_2 also has a bounded timeout in this implementation. closed->listen listen closed->synsent connect / send SYN listen->synrecv SYN / child connection synsent->established SYN+ACK / send ACK synrecv->established ACK established->fin1 local close / FIN established->closewait peer FIN / ACK fin1->fin2 ACK of FIN fin1->closing FIN without FIN ACK fin1->timewait FIN + ACK fin2->timewait peer FIN / ACK closing->timewait ACK closewait->lastack local close / FIN lastack->closed ACK timewait->closed timer · 200 ticks closed CLOSED listen LISTEN synsent SYN_SENT synrecv SYN_RECEIVED established ESTABLISHED fin1 FIN_WAIT_1 fin2 FIN_WAIT_2 closing CLOSING closewait CLOSE_WAIT lastack LAST_ACK timewait TIME_WAIT
Orderly TCP connection lifetime An active open reaches SYN_SENT and accepts SYN+ACK; a listener creates a SYN_RECEIVED child and accepts ACK. Both reach ESTABLISHED. Local close passes FIN_WAIT_1 and FIN_WAIT_2, while peer-first close passes CLOSE_WAIT and LAST_ACK. Simultaneous close may use CLOSING; TIME_WAIT expires after 200 ticks. Resets, retries and cleanup are omitted; FIN_WAIT_2 also has a bounded timeout. Main orderly paths · resets, retries, and error cleanup omitted. FIN_WAIT_2 also has a bounded timeout in this implementation. closed->listen listen closed->synsent connect / send SYN listen->synrecv SYN / child connection synsent->established SYN+ACK / send ACK synrecv->established ACK established->fin1 local close / FIN established->closewait peer FIN / ACK fin1->fin2 ACK of FIN fin1->closing FIN without FIN ACK fin1->timewait FIN + ACK fin2->timewait peer FIN / ACK closing->timewait ACK closewait->lastack local close / FIN lastack->closed ACK timewait->closed timer · 200 ticks closed CLOSED listen LISTEN synsent SYN_SENT synrecv SYN_RECEIVED established ESTABLISHED fin1 FIN_WAIT_1 fin2 FIN_WAIT_2 closing CLOSING closewait CLOSE_WAIT lastack LAST_ACK timewait TIME_WAIT

Active and passive open converge on ESTABLISHED; each close direction has a different path.

Text equivalent and source references
  • An active open reaches SYN_SENT and accepts SYN+ACK; a listener creates a SYN_RECEIVED child and accepts ACK. Both reach ESTABLISHED.
  • Local close passes FIN_WAIT_1 and FIN_WAIT_2, while peer-first close passes CLOSE_WAIT and LAST_ACK. Simultaneous close may use CLOSING; TIME_WAIT expires after 200 ticks. Resets, retries and cleanup are omitted; FIN_WAIT_2 also has a bounded timeout.

State machine. Source paths refer to the atlas baseline; the kernel checkout is private.

  • include/tcp.h · connection state enum
  • kernel/net/tcp.c · tcp_handle_packet, tcp_close, tcp_retransmit_check