buglwIP - A Lightweight TCP/IP stack - Bugs: bug #25467, Listen backlog is not reset on...

 
 

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

bug #25467: Listen backlog is not reset on timeout in SYN_RCVD

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Mon 02 Feb 2009 06:53:00 PM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.3.0

Tue 10 Feb 2009 08:31:05 PM UTC, comment #3: 

Fixed by checking in the patch like below.

Simon Goldschmidt <goldsimon>
Group administrator
Tue 03 Feb 2009 10:53:56 AM UTC, comment #2: 

Hi tested the patch. There was some errors in compilation.

I changed the code (i think in a correct way):

...
    LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge\n"));
   
// piero
// patch from Simon in lwip forum
#if TCP_LISTEN_BACKLOG
    if (pcb->state == SYN_RCVD) {
      /* Need to find the corresponding listen_pcb and decrease its accepts_pending */
      struct tcp_pcb_listen *lpcb;
      LWIP_ASSERT("tcp_pcb_purge: pcb->state == SYN_RCVD but tcp_listen_pcbs is NULL",
        (tcp_listen_pcbs.listen_pcbs != NULL) );
      for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
        if ( (lpcb->local_port == pcb->local_port) &&
            (ip_addr_isany(&(lpcb->local_ip)) ||
             ip_addr_cmp( &(pcb->local_ip), &(lpcb->local_ip) ) )) {
            /* port and address of the listen pcb match the timed-out pcb */
            LWIP_ASSERT("tcp_pcb_purge: listen pcb does not have accepts pending",
              lpcb->accepts_pending > 0);
            lpcb->accepts_pending--;
            break;
          }
      }
    }
#endif /* TCP_LISTEN_BACKLOG */
//  

    if (pcb->refused_data != NULL) {
....


I did some tests using NMAP... it seems to work!
If i understood how Simon patch the lwip code, i suppose there is no impact in other functionality... anyway, i did some test on my application, to check normal behaviour.

Now, when SYN/RST is received (NMAP does this for scanning ports) OR only a SYN packet is received, the accepts_pending is purged
(in the first case when RST is received... i checked with debugger, in the second case, when a timeout for SYN_RCVD is elapsed (20000ms) in slow_timer... i don't have a tool to test this specific situation, i'm finding it...)

I will post here future news about thsi bug and Simon's patch.

Piero

piero <piero74>
Mon 02 Feb 2009 07:26:10 PM UTC, comment #1: 

I've created a patch which should decrease accepts_pending in tcp_pcb_purge for the corresponding listen pcb. However, I'm absolutely not in the position to test it (my netif doesn't setup work...)!

Piero, if you like you can test if this solves your problem.

(file #17387)

Simon Goldschmidt <goldsimon>
Group administrator
Mon 02 Feb 2009 06:53:00 PM UTC, original submission:  

Piero found this and posted on lwip-devel on 02.02.2009:

If TCP_LISTEN_BACKLOG is used, a connection that times out in state SYN_RCVD (and is then purged) does not decrease the counter tpcb->accepts_pending. New connections cannot be established.

Suggested solution: decrease listen_pcb->accepts_pending in tcp_slowtmr when purging a pcb that is in state SYN_RCVD. Unfortunately, we don't have the listen_pcb pointer here, so we will have to search for it in listen_pcbs.

Simon Goldschmidt <goldsimon>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by piero74 (Posted a comment)
  • -email is unavailable- added by goldsimon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-02-10 goldsimon StatusConfirmed Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2009-02-02 goldsimon Attached File- Added purge_SYN_RCVD_backlog.patch, #17387

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code