On Tue, 2009-11-17 at 10:01 +0100, Hervé GARAT : Audemat wrote:
> But in the inet_chksum_pseudo function,the len used to make checksum
> is p->len and not p->tot_len. However the message sent is long as
> p->tot_len, therefore the TCP checksum is Incorrect!! 

The inet_chksum_pseudo function iterates over all the pbufs in the
chain, and checksums their contents individually, summing it all up for
the final checksum.  This is why it looks at p->len for each pbuf, not
p->tot_len.

For example, if you have a chain of three pbufs, each with 100 byte of
data in, they will look like this:

pbuf1: tot_len = 300, len = 100, payload = data1, next = pbuf2
pbuf2: tot_len = 200, len = 100, payload = data2, next = pbuf3
pbuf3: tot_len = 100, len = 100, payload = data3, next = NULL

data1, data2, and data3 are all regions of length 100, so to checksum
the contents of each pbuf we look at the len of each pbuf, not the
tot_len of the chain.

Hope that helps,

Kieran



_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to