From ed65d9cd75b2cb769d5dd117ec31e16b3a94ccd7 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 19 Apr 2009 12:42:48 +0000 Subject: [PATCH] Fixed bug #26236: "TCP options (timestamp) don't work with no-copy-tcpwrite": deallocate option data, only concat segments with same flags --- CHANGELOG | 4 ++++ src/core/tcp_out.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 84f6c7b8..edb3bc8a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -83,6 +83,10 @@ HISTORY ++ Bugfixes: + 2009-04-19 Simon Goldschmidt + * tcp_out.c: Fixed bug #26236: "TCP options (timestamp) don't work with + no-copy-tcpwrite": deallocate option data, only concat segments with same flags + 2009-04-19 Simon Goldschmidt * tcp_out.c: Fixed bug #25094: "Zero-length pbuf" (options are now allocated in the header pbuf, not the data pbuf) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index ace27b6a..d13beb05 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -344,9 +344,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, !(TCPH_FLAGS(useg->tcphdr) & (TCP_SYN | TCP_FIN)) && !(flags & (TCP_SYN | TCP_FIN)) && /* fit within max seg size */ - useg->len + queue->len <= pcb->mss) { + (useg->len + queue->len <= pcb->mss) && + /* only concatenate segments with the same options */ + (useg->flags == queue->flags)) { /* Remove TCP header from first segment of our to-be-queued list */ - if(pbuf_header(queue->p, -TCP_HLEN)) { + if(pbuf_header(queue->p, -(TCP_HLEN + optlen))) { /* Can we cope with this failing? Just assert for now */ LWIP_ASSERT("pbuf_header failed\n", 0); TCP_STATS_INC(tcp.err);