Sun 19 Apr 2009 12:30:34 PM UTC, original submission:
When calling tcp_write (on a pcb with the TF_TIMESTAMP flag turned on) without the COPY flag, it allocates 2 pbufs (RAM for headers + options, ROM for data).
If the last unsent segment has room, the header will be deallocated but the space reserved for the data will not be deallocated. Also, the flags are lost (not copied to the unsent segment).
The obvious solution is to change
if(pbuf_header(queue->p, -TCP_HLEN)) {
to
if(pbuf_header(queue->p, -(TCP_HLEN + optlen))) {
which would effectively deallocate the space reserved for options as well.
However, we would lose the options (from @param optflags): copying the flags to the unsent segment does not work since we cannot be sure there is enough space reserved in the header pbuf of that segment to allocate the options.
I'll check in the above code change since it's obvious, but the cleanest solution for not copying the options would be to not concatenate the two segments if the options are different.
Any comments?
(I've set this planned for 1.3.1 since it's a bug introduced after 1.3.0)
|