Altera_Forum
Honored Contributor
22 years agoLWIP/LAN91C111 Bug!
I've just spent the best part of a day trying to get some simple socket stuff to work under LWIP/uCos.
Symptoms? Telnet-style connections locked up and dropped mysteriously... Anyway, I checked out the comms with Ethereal, and found my PC was simply ignoring some packets from the client. Ethereal marked said packets as having bad TCP checksums - but the frame and IP checksums were OK. To cut a long story short, the last byte of each packet was being checksummed - but not sent! I believe it's a bug in altera_avalon_lan91c111.c's low_level_output() function, failing to handle pbuf chains where the overall length is odd, but the last pbuf length is even... Recommended fix is to change a section of low_level_output() from...
/*
* Last buffer in the packet?
*/
if (total_length_sent == p->tot_len)
{
if (q->tot_len & 1)
{ ... to ...
/*
* Last buffer in the packet?
*/
if (total_length_sent == p->tot_len)
{
if (p->tot_len & 1) // check the TOTAL packet len - q->tot_len cannot be used here
{ Hope that's of use! - Roddy