buglwIP - A Lightweight TCP/IP stack - Bugs: bug #22020, tcp_bind() for listen connection...

 
 

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

bug #22020: tcp_bind() for listen connection fails when connection on this port is active

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Mon 14 Jan 2008 02:58:35 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Wont Fix
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: None

Tue 15 Jan 2008 07:11:43 PM UTC, comment #5:

> I may have misunderstood the problem being described though.


No you haven't. And thanks for the link to the explanation. The thing that was missing for me is that only on windows the following code seems to work, while it doesn't on linux & lwIP:

do {
s1 = socket()
bind(s1)
listen(s1)
s2 = accept(s1)
close(s1)
recv(s2)
send(se)
close(s2)

}while(1);

from the second loop on, bind fails under linux and lwIP. The reason for this is that on windows, only the client side is in TIME_WAIT, the server side is closed right away.

I wonder if there is any standard on this...?

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 15 Jan 2008 03:31:59 PM UTC, comment #4:

For example:

http://www.unixguide.net/network/socketfaq/4.5.shtml

It's discussed in Steven's TCP/IP Illustrated too, which I think is what I remember reading. Basically SO_REUSEADDR is the flag that says "allow me to re-use this address/port even though a connection that is using that address/port is still in the TIME_WAIT state". lwIP doesn't have an SO_REUSEADDR flag or functionality in any of its APIs, and so always refuses.

I may have misunderstood the problem being described though. If so, I apologise!

Kieran Mansley <kieranm>
Project Administrator
Tue 15 Jan 2008 03:02:17 PM UTC, comment #3:

> That's what I thought too.


What you thought or what you read somewhere and still know where? :-)

In other words, I think the lwIP behaviour is kind of odd since a connection in TIME_WAIT keeps a new listen pcb from being created. I'd like to see some documentation about how this should be implemented before really rejecting this.

Simon Goldschmidt <goldsimon>
Project Administrator
Tue 15 Jan 2008 02:45:23 PM UTC, comment #2:

That's what I thought too. Closing this as "wont fix"

Kieran Mansley <kieranm>
Project Administrator
Mon 14 Jan 2008 03:13:32 PM UTC, comment #1:

Untill options SO_REUSEADDR and SO_REUSEPORT are not supported, I think it is correct.

Oleg Tyshev <olegreen>
Mon 14 Jan 2008 02:58:35 PM UTC, original submission:

This was discussed on lwip-users:
http://lists.nongnu.org/archive/html/lwip-users/2008-01/msg00034.html

To summarize the report of lwip_users:
- create listen pcb
- accept connection
- close listen pcb
- process connection
- close connection
- create new listen pcb
-> fails since tcp_bind() fails: the port is still used since the previous connection is still in a wait state

Question: is this behaviour correct or should a listen pcb be allowed when a connection is active (or in a wait state) on this port? Having a quick look over the tcp rfc, I didn't find an answer to this question...

Simon Goldschmidt <goldsimon>
Project Administrator

 

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 olegreen (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Jan 2008 02:45:23 PM UTCkieranmStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1