netdev
[Top] [All Lists]

some questions about TCP/IP stack source codes in Linux Kernel 2.4.2

To: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
Subject: some questions about TCP/IP stack source codes in Linux Kernel 2.4.2
From: Laurence <laudney@xxxxxxxx>
Date: Thu, 14 Feb 2002 1:44:50 +0800
Organization: SJTU
Reply-to: laudney@xxxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
        (I'd like to receive replies in emails) 

        I have some questions about the source codes related with connecting in 
the kernel 2.4.2 tcp/ip stack.

First:
        When the client starts active open in tcp, various funtions are invoked 
in the following sequence:
        connect() ----> sys_connect() ----> inet_stream_connect() ----> 
tcp_v4_connect() ----> tcp_connect() ----> tcp_transmit_skb()

        After that, nothing is written to it. Then, buff is used as one 
argument to invoke tcp_connect() (net/ipv4/tcp_output.c).  In tcp_connect(), I 
found the following:

        /* We'll fix this up when we get a response from the other end.
         * See tcp_input.c:tcp_rcv_state_process case TCP_SYN_SENT.
         */
        tp->tcp_header_len = sizeof(struct tcphdr) +
                (sysctl_tcp_timestamps ? TCPOLEN_TSTAMP_ALIGNED : 0);


        tcp_connect() invokes tcp_transmit_skb() (net/ipv4/tcp_output.c). At 
the start of tcp_transmit_skb(), I found the following:

                        if (tcb->flags & TCPCB_FLAG_SYN) {
                        tcp_header_size = sizeof(struct tcphdr) + TCPOLEN_MSS;
                        if(sysctl_tcp_timestamps) {
                                tcp_header_size += TCPOLEN_TSTAMP_ALIGNED;
                                sysctl_flags |= SYSCTL_FLAG_TSTAMPS;
                        }


Since sysctl_tcp_timestamps doesn't seem to be changed,  TCPOLEN_TSTAMP_ALIGNED 
is added to tp->tcp_header_len twice!!!! I'm puzzled here!!!! :-(


Second:
        in tcp_opt, we have snd_wnd and rcv_wnd. It seems rcv_wnd is the window 
that we use and snd_wnd is the window that the remote host advertise everytime 
in the tcp packet. Am I right or just the opposite?? If I'm right, in 
tcp_connect(), there is one line:

                tp->snd_wnd = 0;


Well, it does so because tcp_connect sends a packet with only SYN and no data??
If I want to carry data in SYN packet, I have to set tp->snd_wnd to 2*MSS or 
some other value?



-- Laudney



<Prev in Thread] Current Thread [Next in Thread>
  • some questions about TCP/IP stack source codes in Linux Kernel 2.4.2, Laurence <=