Re: TCP/IP stack

From: Kevin Buhr (
Date: Fri Jun 29 2001 - 10:32:21 EST

Michael J Clark <> writes:
> I have been reading through TCP/IP Illustrated Vol 2 and the linux
> source. I am having a heck of a time finding where it sees a SYN packet
> and check to see if the desitination port is open. In the book it looks
> like it happens in tcp_input where it looks for the PCB for a segment.
> Any pointers would be greatly appeciated.

In 2.2.19 (since I have the source handy), this processing is done in
"linux/net/ipv4/tcp_input.c" in function "tcp_rcv_state_process". If
a SYN packet arrives and the socket is in state TCP_LISTEN, the
address-family-specific "conn_request" function is called. For IPv4,
this is "tcp_v4_conn_request" in "tcp_ipv4.c".

On the other hand, if a SYN packet is sent to a TCP_CLOSE socket,
"tcp_rcv_state_process" returns 1. This is an indication to the
caller ("tcp_v4_do_rcv" in "tcp_ipv4.c", in the case of IPv4) to send
a RST packet.

Kevin <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jun 30 2001 - 21:00:22 EST