lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] udp checksum error


From: Goldschmidt Simon
Subject: RE: [lwip-users] udp checksum error
Date: Thu, 17 Jan 2008 12:50:37 +0100

>>     int addrlen = (endpoint)->sin_len = 
>> sizeof((endpoint)->sin_addr.s_addr);
> 
> The above line is wrong. You need addrlen to be sizeof(endpoint).
> 
> NB, there's no need to set sin_len - it exists only for compatibility
with other stacks, and isn't even part of the > POSIX standard any more.

Can this be a problem? The 'tolen' parameter of lwip_sendto (your
'addrlen' variable) is not checked in all versions of lwIP - it is not
checked in v1.2.0! So your program should send anyway, which it seems to
do: if the addrelen was checked and found to be wrong, lwip_sendto would
have returned an error and the datagrams wouldn't have been sent.

UDP sockets send by reference (the data is not copied into a stack
internal buffer for sending). This _could_ lead to a problem (especially
in conjunction with a possible data cache and a DMA ethernet MAC), but
it is rather unlikely in your case, since you don't change the
application data buffer inside the while(1)-loop...

Nevertheless, a data cache _could_ be the problem if you don't
invalidate it before sending. Since the TCP code is bigger (and uses
more data before sending) than the UDP code, it could be that TCP is
(accidentally) working while UDP is not...


Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]