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,12 +916,17 @@ 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; off = pcb->rcv_nxt - seqno;
if (inseg.p->len < off) {
p = inseg.p; p = inseg.p;
if (inseg.p->len < off) {
new_tot_len = inseg.p->tot_len - off;
while (p->len < off) { while (p->len < off) {
off -= p->len; off -= p->len;
inseg.p->tot_len -= p->len; /* KJM following line changed (with addition of new_tot_len var)
to fix bug #9076
inseg.p->tot_len -= p->len; */
p->tot_len = new_tot_len;
p->len = 0; p->len = 0;
p = p->next; p = p->next;
} }
@ -928,7 +934,9 @@ tcp_receive(struct tcp_pcb *pcb)
} else { } else {
pbuf_header(inseg.p, -off); pbuf_header(inseg.p, -off);
} }
inseg.dataptr = inseg.p->payload; /* 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.len -= pcb->rcv_nxt - seqno;
inseg.tcphdr->seqno = seqno = pcb->rcv_nxt; inseg.tcphdr->seqno = seqno = pcb->rcv_nxt;
} }