diff --git a/CHANGELOG b/CHANGELOG index 17e1a750..b5c8d835 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,10 @@ HISTORY ++ New features: + 2011-03-22: Simon Goldschmidt + * tcp_impl.h, tcp_in.c, tcp_out.c: Removed 'dataptr' from 'struct tcp_seg' and + calculate it in tcp_zero_window_probe (the only place where it was used). + 2010-11-21: Simon Goldschmidt * dhcp.c/.h: Added a function to deallocate the struct dhcp from a netif (fixes bug #31525). diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 60ade915..90952648 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -291,7 +291,6 @@ tcp_input(struct pbuf *p, struct netif *inp) /* Set up a tcp_seg structure. */ inseg.next = NULL; inseg.len = p->tot_len; - inseg.dataptr = p->payload; inseg.p = p; inseg.tcphdr = tcphdr; @@ -1167,9 +1166,6 @@ tcp_receive(struct tcp_pcb *pcb) LWIP_ASSERT("pbuf_header failed", 0); } } - /* KJM following line changed to use p->payload rather than inseg->p->payload - to fix bug #9076 */ - inseg.dataptr = p->payload; inseg.len -= (u16_t)(pcb->rcv_nxt - seqno); inseg.tcphdr->seqno = seqno = pcb->rcv_nxt; } diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 32729081..6e59e1f7 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -166,7 +166,6 @@ tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno, seg->flags = optflags; seg->next = NULL; seg->p = p; - seg->dataptr = p->payload; seg->len = p->tot_len - optlen; #if TCP_OVERSIZE_DBGCHECK seg->oversize_left = 0; @@ -590,10 +589,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) seg->chksum_swapped = chksum_swapped; seg->flags |= TF_SEG_DATA_CHECKSUMMED; #endif /* TCP_CHECKSUM_ON_COPY */ - /* Fix dataptr for the nocopy case */ - if ((apiflags & TCP_WRITE_FLAG_COPY) == 0) { - seg->dataptr = (u8_t*)arg + pos; - } /* first segment of to-be-queued data? */ if (queue == NULL) { @@ -1444,7 +1439,9 @@ tcp_zero_window_probe(struct tcp_pcb *pcb) TCPH_FLAGS_SET(tcphdr, TCP_ACK | TCP_FIN); } else { /* Data segment, copy in one byte from the head of the unacked queue */ - *((char *)p->payload + TCP_HLEN) = *(char *)seg->dataptr; + struct tcp_hdr *thdr = (struct tcp_hdr *)seg->p->payload; + char *d = ((char *)p->payload + TCP_HLEN); + pbuf_copy_partial(seg->p, d, 1, TCPH_HDRLEN(thdr) * 4); } #if CHECKSUM_GEN_TCP diff --git a/src/include/lwip/tcp_impl.h b/src/include/lwip/tcp_impl.h index 320b88ef..b4feec0d 100644 --- a/src/include/lwip/tcp_impl.h +++ b/src/include/lwip/tcp_impl.h @@ -278,7 +278,6 @@ PACK_STRUCT_END struct tcp_seg { struct tcp_seg *next; /* used when putting segements on a queue */ struct pbuf *p; /* buffer containing data + TCP header */ - void *dataptr; /* pointer to the TCP data in the pbuf */ u16_t len; /* the TCP length of this segment */ #if TCP_OVERSIZE_DBGCHECK u16_t oversize_left; /* Extra bytes available at the end of the last