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

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Mon 02 Feb 2009 06:53:00 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by piero74 (Posted a comment)
  • -unavailable- added by goldsimon (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
    Tue 10 Feb 2009 08:31:05 PM UTCgoldsimonStatusConfirmed=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Mon 02 Feb 2009 07:26:10 PM UTCgoldsimonAttached File-=>Added purge_SYN_RCVD_backlog.patch, #17387

    Back to the top


    Powered by Savane 3.1-cleanup1