lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Re: tcp_receive bugfix - incoming segment is, larger than t


From: Oleg Tychev
Subject: [lwip-users] Re: tcp_receive bugfix - incoming segment is, larger than the old segment
Date: Fri, 09 Feb 2007 10:56:25 +0100
User-agent: Thunderbird 1.5.0.9 (Windows/20061207)

Hello All,

after review my own fix, I find out, that it was wrong:)
There is new one.

Oleg Tychev

Here is patch against version lwip-1.2.0





--

HIMA Paul Hildebrandt GmbH + Co KG, Postfach 12 61, 68777 Bruehl bei Mannheim
Kommanditgesellschaft, Sitz Bruehl, Deutschland - Registergericht Mannheim HRA 10 17 S Ust-ID: DE 144286400, St.Nr: 43038 00190

Persoenlich haftende Gesellschafterin Paul Hildebrandt Verwaltungsgesellschaft mbH, Sitz Bruehl, Deutschland - Registergericht Mannheim HRB 05 88 S -
Geschaeftsfuehrer: Dipl.-Betriebswirt Steffen Philipp, Dipl.-Kfm. Peter 
Swiczinsky

*** lwip-1.2.0/src/core/tcp_in.c        Fri Aug 18 13:18:42 2006
--- lwip-1.2.0/src/core/tcp_in_fix.c    Fri Feb  9 10:41:34 2007
***************
*** 1052,1073 ****
--- 1052,1082 ----
                  /* The incoming segment is larger than the old
                     segment. We replace the old segment with the new
                     one. */
                  cseg = tcp_seg_copy(&inseg);
                  if (cseg != NULL) {
                    cseg->next = next->next;
                    if (prev != NULL) {
                      prev->next = cseg;
                    } else {
                      pcb->ooseq = cseg;
                    }
+                   tcp_seg_free(next);
+                   if (cseg->next != NULL) {
+                     next = cseg->next;
+                     if (TCP_SEQ_GT(seqno + cseg.len, next->tcphdr->seqno)) {
+                       /* We need to trim the incoming segment. */
+                       cseg.len = next->tcphdr->seqno - seqno;
+                       pbuf_realloc(cseg.p, cseg.len);
+                     }
+                   }
                  }
                  break;
                } else {
                  /* Either the lenghts are the same or the incoming
                     segment was smaller than the old one; in either
                     case, we ditch the incoming segment. */
                  break;
                }
              } else {

reply via email to

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