Kieran Mansley - kjm25@cam.ac.uk - 26th May 2004

* Fixed bug 9076 (changes to pbuf tot_len and seg dataptr when trimming front edge of a received packet)
This commit is contained in:
kieranm 2004-05-26 10:04:15 +00:00
parent 26819e6c39
commit 450dd65165

View File

@ -672,6 +672,7 @@ tcp_receive(struct tcp_pcb *pcb)
s32_t off; s32_t off;
int m; int m;
u32_t right_wnd_edge; u32_t right_wnd_edge;
u16_t new_tot_len;
if (flags & TCP_ACK) { if (flags & TCP_ACK) {
@ -915,22 +916,29 @@ tcp_receive(struct tcp_pcb *pcb)
After we are done with adjusting the pbuf pointers we must After we are done with adjusting the pbuf pointers we must
adjust the ->data pointer in the seg and the segment adjust the ->data pointer in the seg and the segment
length.*/ length.*/
off = pcb->rcv_nxt - seqno;
if (inseg.p->len < off) { off = pcb->rcv_nxt - seqno;
p = inseg.p; p = inseg.p;
while (p->len < off) { if (inseg.p->len < off) {
off -= p->len; new_tot_len = inseg.p->tot_len - off;
inseg.p->tot_len -= p->len; while (p->len < off) {
p->len = 0; off -= p->len;
p = p->next; /* KJM following line changed (with addition of new_tot_len var)
} to fix bug #9076
pbuf_header(p, -off); inseg.p->tot_len -= p->len; */
} else { p->tot_len = new_tot_len;
pbuf_header(inseg.p, -off); p->len = 0;
} p = p->next;
inseg.dataptr = inseg.p->payload; }
inseg.len -= pcb->rcv_nxt - seqno; pbuf_header(p, -off);
inseg.tcphdr->seqno = seqno = pcb->rcv_nxt; } else {
pbuf_header(inseg.p, -off);
}
/* KJM following line changed to use p->payload rather than inseg->p->payload
to fix bug #9076 */
inseg.dataptr = p->payload;
inseg.len -= pcb->rcv_nxt - seqno;
inseg.tcphdr->seqno = seqno = pcb->rcv_nxt;
} }
else{ else{
/* the whole segment is < rcv_nxt */ /* the whole segment is < rcv_nxt */