buglwIP - A Lightweight TCP/IP stack - Bugs: bug #22983, Bugs in unix port unixsim program

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #22983: Bugs in unix port unixsim program

Submitted by:  Rishi Khan <rishi>
Submitted on:  Sat 19 Apr 2008 07:29:44 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Kieran Mansley <kieranm>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.3.0

(Jump to the original submission Jump to the original submission)

Fri 30 May 2008 11:59:32 AM UTC, comment #6:

I've checked in all of these changes, I think. Resolving FIXED. If there are any further issues please open separate bug reports for each one.

Kieran Mansley <kieranm>
Project AdministratorIn charge of this item.
Wed 14 May 2008 01:00:54 PM UTC, comment #5:

Could you prepare and submit a patch for these changes? It would make it much clearer what's being modified and be easier to apply to CVS.

Kieran Mansley <kieranm>
Project AdministratorIn charge of this item.
Sun 04 May 2008 11:22:52 PM UTC, comment #4:

Also, if you remove the sys_timeout in tapif, you can remove the arp_timer function in tapif too.

While we're at it, the etharp_init() is unnecessary too (it is called in lwip_init()).

I tested removing the calls to sys_timeout() and etharp_init() and removing the arp_timer() function (all in tapif.c) and these all seem to cause no problems for the shell, echo, and webserver tests.

-rishi

Rishi Khan <rishi>
Sun 04 May 2008 11:04:02 PM UTC, comment #3:

I am using 1.3.0:

1) You would think so. However, if I add the following at line 323 of memp.c:
printf("type=%d,used=%d,max=%d,avail=%d\n",type,lwip_stats.memp[type].used,lwip_stats.memp[type].max,lwip_stats.memp[type].avail);
printf("systimeouts=%d, needed =%d\n", MEMP_NUM_SYS_TIMEOUT, LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT);

I get this (using the proper greps):
systimeouts=10, needed =3
and before a telnet to port 23:
type=11,used=3,max=3,avail=10
and after:
type=11,used=4,max=4,avail=10
(note, this already includes my increase from 3 to 10) ... I was incorrect in my original bug post .. it was 3, not 2.

After trapping in memp.c and looking where the calls are made from here are the results:
tcpip.c:239 (tcpip_thread if IP_REASSEMBLY)
tcpip.c:242 (tcp_timer_needed if LWIP_ARP)
tapif.c:353 (tapif_init .. for an arp_timer)
tcpip.c:106 (tcp_timer_needed if LWIP_TCP)

So my guess is that the tapif.c timeout is the problem. It seems that the arp_timer is superflous because tcpip.c:242 makes the same call. If you remove this tapif sys_timeout, the program seems to work fine.

In fact, it would seem that the program shouldn't even compile (because of the naming conflict) except for the saving grace of the 'static' function declaration.

So, I offer a better fix: Remove the sys_timeout in tapif.c on line 352.

2) The bug is that the variables that the printf points to are NULL. One easy fix is to make this "" instead of NULL. However, it would probably be better to rewrite this as a stat_display() call.

Rishi Khan <rishi>
Sun 04 May 2008 07:58:27 PM UTC, comment #2:

Rishi,

In init.c, there is this sanity check:

/* There must be sufficient timeouts, taking into account requirements of the subsystems. */
#if ((NO_SYS==0) && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)))
#error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts"
#endif

Isn't it enought for the first point?

For the second point, I don't have values, but a U16_F for stats format. Which lwIP release do you use ?

Frédéric Bernon <fbernon>
Project Member
Sat 19 Apr 2008 07:36:39 PM UTC, comment #1:

Whoops ... I meant MEMP_NUM_SYS_TIMEOUT was set to 3 ... not 2. It must be set to larger than 3 for it not to die on assertion during a TCP connection.

-RISHI

Rishi Khan <rishi>
Sat 19 Apr 2008 07:29:44 PM UTC, original submission:

1) The number of SYS_TIMEOUT memblocks is too small. It is set to 2 and when I compile this on ubuntu linux, the program segfaults on the assertion "sys_timeout: timeout != NULL". What is actually happening if you turn on the memory debug is that the SYS_TIMEOUT pool is running out. However, when I increase this number and display the stats later, only 3 are used at the max. I'm not sure the problem, but increasing MEMP_NUM_SYS_TIMEOUT beyond 3 fixes it.

2) In apps/shell.c, there is a null pointer exception because at line 311, the values are set to NULL. I'm not sure the proper behavior, but if you just remove these and resize STATS_NUM and edit stat_msgs accordingly, all is well. Alternatively, the whole thing could be rewritten to use stat_display().

Rishi Khan <rishi>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kieranm (Posted a comment)
  • -unavailable- added by fbernon (Posted a comment)
  • -unavailable- added by rishi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 30 May 2008 11:59:32 AM UTCkieranmStatusNone=>Fixed
      Assigned toNone=>kieranm
      Open/ClosedOpen=>Closed
      Planned Release=>1.3.1

    Back to the top


    Powered by Savane 3.1-cleanup1