lwip-users
[Top][All Lists]
Advanced

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

R: [lwip-users] Assertion failure in tcp_receive


From: Bessone Danilo
Subject: R: [lwip-users] Assertion failure in tcp_receive
Date: Fri, 17 Mar 2006 09:00:43 +0100

 
Hi,

Sorry for my english.

I also encountered a problem in transmitting large amount of data using the raw API interface (version 1.1.0) but in my case the program does not crash. My problem was the transmission of corrupted data. I have discovered that the problem is due of what - I think - is a little bug in the tcp_receive() function. I have found that, as consequence of this bug, the callback function specified with tcp_sent() is erroneously called when an ACK packet is received under particular circumstances (please see my post in date 2006-03-1 for more details). In this rare case the total number of acknowledged bytes computed by the application program is greater than the number of bytes really acknowledged by the lwIP protocol core. If the transmission has been invoked by calling the tcp_write() function (in my case with the NO_COPY option set) and the memory used to store the data to transmit is deallocated or reused immediately after the transmission callback function has computed a number of acknowledged bytes (that can be wrong in some rare cases) that is equal or greater than the data length specified by tcp_write()then many errors conditions can arise as consequence of the same area of memory that can be used at the same time by the application program and the lwIP core.

In my case this problem is disappeared placing the code "pcb->acked = 0" at the beginning of the tcp_receive() function or - perhaps more elegant - at the position specified:

static void tcp_receive() {

....
....
if (pcb->lastack == ackno) {
pcb->acked = 0;
....
....
}
else if(TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_max)){
....
pcb->acked = ackno - pcb->lastack;
....
}
else // Code to add in order to complete
pcb->acked = 0; // all checks on the ackno value

....
....
}

I hope this can help you.

Regards

Danilo Bessone

-----Messaggio originale-----
Da: address@hidden [mailto:address@hidden Per conto di Jeffery Du
Inviato: venerdì 17 marzo 2006 2.00
A: lwip-users
Oggetto: [lwip-users] Assertion failure in tcp_receive

Hi,

I am a software engineer from China. I am working on a set top box project, in which we use TCP/IP protocol to transmit control command and user data. I've ported the LWIP (1.1.0) to our platform (OS20 of ST Microelectronics) and it can work basically.

But I encountered a problem currently. When a large amount of data are transmitting, the program is very easy to crash at an assertion in tcp_receive:
if (pcb->snd_queuelen != 0) {
LWIP_ASSERT("tcp_receive: valid queue length",
pcb->unacked != NULL || pcb->unsent != NULL);
}
I've checked the bug list on website: http://savannah.nongnu.org/projects/lwip,
But I didn't find any report about this problem. I wrote application to use raw API directly.
Can anyone give me some hints?

Best regards
Jeffery Du
2006-03-17



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
--------------------------------------------------------------------
CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to
address@hidden.
        Thank you
                                       
www.telecomitalia.it
--------------------------------------------------------------------

reply via email to

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