[lwip-users] Checksum Incorrect caused by Concatenation
From:
herve garat
Subject:
[lwip-users] Checksum Incorrect caused by Concatenation
Date:
Mon, 16 Nov 2009 16:01:58 +0100
Hi All,
I use the last CVS Head LWIP on LPC2468 with FreeRTOS. My embedded system communicates by IP with a PC. When the PC IP interfaces restart, I look for a checksum incorrect packet on Wireshark.
This error seems to be a concatenate error. 172.17.2.173:my embedded system with LWIP; 172.17.2.172 : PC
130 9.307578 172.17.2.173 172.17.2.172 TCP 5678 > 48955 [PSH, ACK] Seq=62870 Ack=0 Win=5840 [TCP CHECKSUM INCORRECT] Len=740 <- this packet is a concatenation of the same packets than 111 and 113
142 9.789090 172.17.2.173 172.17.2.172 TCP 5678 > 48955 [PSH, ACK] Seq=65070 Ack=0 Win=5840 [TCP CHECKSUM INCORRECT] Len=1323 <- this packet is a concatenation of the same packets than 117 and 119ss
In the pbuf_cat function “p->next” must not be equal to “t”, but must be equal to “NULL”. And we must write “p->len+=t->len;”. And next after the call of “pbuf_cat(useg->p, queue->p);” in “tcp_enqueue fuction” tcp_out.c , we have Add two line:
pbuf_cat(useg->p, queue->p);
useg->len += queue->len;
useg->next = queue->next;
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("tcp_enqueue: chaining segments, new len %"U16_F"\n", useg->len));
if (seg == queue)
{
seg = useg;
seglen = useg->len;
queuelen--; //decrementation of the SND_QUEUELEN due to concatenation
}
memp_free(MEMP_TCP_SEG, queue);
pbuf_free(queue->p); /dereference a pbuf chain due to concatenation
Thanks to this modification I haven’t a TCP CHECKSUM INCORRECT in wireshark and the communication works fine.
Can you tell me if this modification are the best and if they will not be cause of a problem.