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

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Mon 14 Jan 2008 02:58:35 PM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned 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>
Group 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>
Group Member
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>
Group 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>
Group Member
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>
Group administrator

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by olegreen (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-01-15 kieranm StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12