[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #37184] tcp_write problem for pcbs in the SYN_SENT sta

From: Zach Smith
Subject: [lwip-devel] [bug #37184] tcp_write problem for pcbs in the SYN_SENT state
Date: Fri, 24 Aug 2012 22:43:59 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1


                 Summary: tcp_write problem for pcbs in the SYN_SENT state
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: zsmith
            Submitted on: Fri 24 Aug 2012 10:43:58 PM GMT
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.0



if the pcb passed to tcp_write is in the state SYN_SENT then this line:
"u16_t mss_local = LWIP_MIN(pcb->mss, pcb->snd_wnd_max/2);"
evaluates to 0 because the pcb->snd_wnd_max has not been set yet (have not yet
rcvd SYN_ACK from remote host)

then tcp_write_checks() checks the state of the pcb and allows SYN_SENT as a
valid state for data transmission

then down in "phase 3" where the new segments are created in the while (pos <
len){} loop the following line:
"u16_t max_len = mss_local - optlen;"
evaluates to 0.  So, the subsequent pbufs and segments are created with a len
of 0. pos never increments and we loop around this loop until queuelen >
TCP_SND_QUEUELEN at which point execution jumps to memerr.  The data is not
added for transmission and returns ERR_MEM.

I don't know what the solution to this should be because a connection in the
SYN_SENT state hasn't yet received the advertised MSS from the remote host and
can't know what size it will be.  Is it safe to assume the default size of 536
in this case?

My use case is that I have created a tcp client connection by calling
tcp_connect() and then just shortly afterwards (while pcb is still in SYN_SENT
state) I call tcp_write with some data to go out.  perhaps I should wait until
the connection is established to send data but the fact remains that tcp_write
(tcp_write_checks) doesn't error on pcbs in the SYN_SENT state.

thank you


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]