lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] Out of order segment handling


From: Kieran Mansley
Subject: [lwip-users] [lwip] Out of order segment handling
Date: Wed, 08 Jan 2003 23:59:56 -0000

When a segment is received in tcp_input, the packet is added to the ooseg
queue if the sequence number is not with the window.  Checks are made to
see if the sequence number of the incoming segment is less than rcv_nxt,
and the sequence number plus the length of the segment is larger than
rcv_nxt, and this is dealt with appropriately.  However, if the whole
segment is less than rcv_nxt it drops through to being added to the ooseg
queue.  (I think).

This strikes me as wrong.  For rcv_nxt to have progressed past this entire
segment, it must be a duplicate segment, possibly as the result of an
unnecessary retransmit.  Adding it to ooseg queue serves no purpose, as it
will never get removed (until the sequence numbers wrap, and they'll
you'll get real problems).

It should be easy to fix, but I thought I'd just check here first in case
anyone else has anything to say about it, or there's something I've
missed.

There was another related bug in the out or order segment code that you
might be interested in too.  In tcp_receive when out of order segments are
checked and found to now be in order, they are chained to the recv_data.
However, if recv_data is null this will segfault.  Changing it to:

          if(cseg->p->tot_len > 0) {
            /* Chain this pbuf onto the pbuf that we will pass to
               the application. */
            /* KJM added check on recv_data */
            if(pcb->recv_data)
              pbuf_chain(pcb->recv_data, cseg->p);
            else
              pcb->recv_data = cseg->p;
            cseg->p = NULL;
          }


Should fix it.

Kieran

[This message was sent through the lwip discussion list.]




reply via email to

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