lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #28054] Two segments with FIN flag on the out-of-seque


From: Oleg Tyshev
Subject: [lwip-devel] [bug #28054] Two segments with FIN flag on the out-of-sequence queue
Date: Fri, 20 Nov 2009 17:05:00 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 GTB5

Follow-up Comment #8, bug #28054 (project lwip):

Selected lines do this work
If first segment overlap completely 2nd, 3rd, etc.,
they will be deleted.

>  /*if (TCP_SEQ_LT(prev->tcphdr->seqno, seqno) &&
>    TCP_SEQ_LT(seqno, next->tcphdr->seqno)) {*/
>  if(TCP_SEQ_BETWEEN(seqno, prev->tcphdr->seqno+1, next->tcphdr->seqno-1)){
>  /* The sequence number of the incoming segment is in
>     between the sequence numbers of the previous and
>     the next segment on ->ooseq. We trim and insert the
>     incoming segment and trim the previous segment, if
>     needed. */
>  cseg = tcp_seg_copy(&inseg);
>  if (cseg != NULL) {
>    if (TCP_SEQ_GT(prev->tcphdr->seqno + prev->len, seqno)) {
>      /* We need to trim the prev segment. */
>      prev->len = (u16_t)(seqno - prev->tcphdr->seqno);
>      pbuf_realloc(prev->p, prev->len);
>    }
>    prev->next = cseg;
>    if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) {
>      cseg->next = NULL;
>      while (next != NULL) {
>        struct tcp_seg *old_seg = next;
>        next = next->next;
>        memp_free(MEMP_TCP_SEG, old_seg);
>      }               
>    }
>    else {
>>>>>  /* delete some segments */
>>>>>  while (next &&
>             TCP_SEQ_GT((seqno + cseg->len),
>                        (next->tcphdr->seqno + next->len))) {
>        struct tcp_seg *old_seg = next;
>        next = next->next;
>        memp_free(MEMP_TCP_SEG, old_seg);
>      }
>      if (next &&
>          TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) {
>        /* We need to trim the incoming segment. */
>        cseg->len = (u16_t)(next->tcphdr->seqno - seqno);
>        pbuf_realloc(cseg->p, cseg->len);
>      }
>      cseg->next = next;
>    }
>  }
>  break;


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?28054>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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