Passive Connection Establishment

Active connection setup does not originate from the kernel itself but is triggered by receipt of a SYN packet with a connection request. The starting point is therefore the tcp_v4_rcv function, which, as described above, finds a listening socket and transfers control to tcp_v4_do_rcv, whose code flow diagram (for this specific scenario) is shown in Figure 12-28.

tcp_v4_rcv

tcp_v4

_do

_rcv J

tcp_v4_hnd_req |

tcp_rcv_state_process|

Figure 12-28: Code flow diagram for tcp_v4_rcv_passive.

tcp_v4_hnd_req is invoked to perform the various initialization tasks required in the network layer to establish a new connection. The actual state transition takes place in tcp_rcv_state_process, which consists of a long case statement to differentiate between the possible socket states and to invoke the appropriate transition function.

Possible socket states are defined in an enum list:

Continue reading here: Includenettcpstatesh

Was this article helpful?

0 0