Includenettcpstatesh

TCP_ESTABLISHED = 1,

TCP_SYN_SENT,

TCP_SYN_RECV,

TCP_FIN_WAIT1,

TCP_FIN_WAIT2,

TCP_TIME_WAIT,

TCP_CLOSE,

TCP_CLOSE_WAIT,

TCP_LAST_ACK,

TCP_LISTEN,

TCP_CLOSING, /* Now a valid state */ TCP_MAX_STATES /* Leave at the end! */

tcp_v4_conn_request is invoked if the socket state is tcp_listen.29 The function concerns itself with many details and subtleties of TCP that are not described here. What is important is the acknowledgment packet sent at the end of the function. It contains not only the set ACK flag and the sequence number of the received packet but also a newly generated sequence number and a SYN flag as required by the three-way handshake procedure. This concludes the first phase of connection setup.

The next step at the client is reception of the ACK packet that arrives at the tcp_rcv_state_process function via the usual path. The socket state is now tcp_syn_recv, which is handled by a separate branch of case differentiation. The main task of the kernel is to change the socket state to tcp_established to indicate that a connection has now been set up.

Continue reading here: Active Connection Establishment

Was this article helpful?

0 0