Documente Academic
Documente Profesional
Documente Cultură
A LISTE S ppli ; en ca YN N d: tio e: S ACK SY n.: ceiv N, ST Re d : SY se : R Passive opening N nd sen ive e c da Re ta SYN_REC SYN_SEN Receive: SYN send: SYN, ACK V T Simultanous opening
eo ng ni pe
AC K
FIN_WAIT_ 2
Passive close Re Se ceiv nd e: : A FIN CK CLOSE_WA IT Simultanous close Application: close Receive: FIN Send: FIN CLOSIN Send: ACK G R Receive: ACK Se ece LAST_AC Receive: ACK Send: --nd ive :A :F K Send: --CK IN ,A C K TIME_WA IT Receive: FIN Send: ACK 2 MSL timeout Active close ESTABLISHE D Data transmission MSL: max. segment life
Re Se ceiv nd e: : A SY CK N ,
:A ive ce --Re nd : Se CK
SYN_SENT
After sending SYN, but before receiving ACK
SYN_RECV
Receiving SYN from others
ESTABLISHED
Finished three-way handshaking
Fall 2004 FSU CIS 5930 Internet Protocols 3
Fall 2004
Fall 2004
tcp_rcv_state_process()
Big function to handle TCP state transitions Specific behavior depending on current state and packet received
if (th->ack) { switch (sk->state) { case TCP_SYN_RECV: tcp_set_state(sk, TCP_ESTABLISHED); } }
Fall 2004 FSU CIS 5930 Internet Protocols 9
FIN_WAIT_1: We close but not receive ACK FIN_WAIT_2: We close and receive ACK CLOSING: Both FINed, waiting for ACK TIME_WAIT: graceful close (wait some time) CLOSE_WAIT: They close and we ACK LAST_ACK: They close, then we close, waiting for ACK CLOSED: connection is now closed
FSU CIS 5930 Internet Protocols 10
tcp_fin()
Fall 2004 Fall 2004 FSU CIS 5930 Internet Protocols 12
Timer management
Seven different timers are maintained in TCP
SYNACK: waiting for ACK to our SYN Retransmit: for data retransmission, exponential backoff Delay ACK: hoping for piggy-back ACK Keepalive: checking if a connection alive Probe: testing if zero window size still applies FIN_WAIT_2: switch to CLOSED if no FIN received TWKill: how long to stay in TIME_WAIT
Fall 2004 FSU CIS 5930 Internet Protocols 19 Fall 2004
20