[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] bug in pcb->snd_queuelen and other
From: |
Adam Dunkels |
Subject: |
[lwip-users] Re: [lwip] bug in pcb->snd_queuelen and other |
Date: |
Wed, 08 Jan 2003 22:34:42 -0000 |
HI Andrea!
On Tuesday 22 January 2002 21.40, you wrote:
> - The bug I found is present in the 20020121 CVS as well. I'm using a 16MHz
> 8051 with a very slow CS8900A driver, few RAM. I made a simple server that
> after the connection sends 100 bytes every 50ms.
> I made also a simple VB application that connects to the server and
> measures the datarate every seconds.
> After a minute the datarate slow down to 0, because pcb->snd_queuelen is
> 255. I guess there was a 0x00 - 1 = 0xff, so one more decrement. After that
> I can't send data anymore, till I close and reopen the connection.
After a lot of hassle, I think I have managed to track this one down. The
problem was with a condition that happened quite rarely, but often enough to
be noticed. The problem happened when tcp_write() was called from a timeout
function that happened to occur just when a pbuf was being deallocated from
tcp_segs_free(). Since pbufs can be allocated and deallocated in different
threads, they use the memp_mallocp() and memp_freep() that can trigger a
timeout. When tcp_write() was called from the timeout, the pcb->unsent queue
was trashed so pcb->snd_queuelen was wrong.
I fixed it by adding another function to the pbuf.c module: pbuf_clen(),
which returns the length of a pbuf chain. The current version uses this
function to calculate the new snd_queuelen instead of tcp_seg_free().
Thanks for spotting this!
> - I ported the same CVS to Linux. My platform is a Mandrake 8.1 with 2.4.16
> kernel.
> To make the binary, I have to delete the pcapif.c file and to change
> "/dev/net/tun" to "/dev/tun" in tapif.c.
> I run nmap and the xterm say:
> "...Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 3076 (LWP 11088)]
> 0x080493ac in sys_mbox_post (mbox=0x0, msg=0x0) at
> ../../src/arch/unix/sys_arch.c:194..."
> Running lwIP form within DDD show that there is a probelm at that line.
netconn_delete() would try to deallocate an mbox that was NULL. Thanks again
for spotting this!
> - There is a *data pointer in inet.h, that Keil compiler doesn't like very
> much. Could you change in *dataptr?
Done!
> - My wonderful Keil compiler doesn't initialize to 0 or NULL the list
> pointers. Could you initialize all the pointers (at the beginning of a
> module and in every function that might create problems) to NULL
> explicitly?
I have added explicit initializations to the TCP module. Does Keil have
problems with explicitly declared variables such as the ones in netif.c as
well? If so, an netif_init() function will have to be added.
> - I'd like to have some more defines in lwipopts.h:
> #define LWIP_DHCP 1
> #define LWIP_UDP 1
> #define LWIP_TCP 1
UDP and TCP are now added. DHCP support isn't in yet, but when it is, such an
option will be added.
Thanks,
/adam
--
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] Re: [lwip] bug in pcb->snd_queuelen and other,
Adam Dunkels <=