buglwIP - A Lightweight TCP/IP stack - Bugs: bug #1895, tcp_bind not correct

 
 

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

bug #1895: tcp_bind not correct

Submitter:  Kieran Mansley <kieranm>
Submitted:  Thu 05 Dec 2002 10:03:02 AM 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:  None

Wed 30 May 2007 06:18:03 AM UTC, comment #5: 

Closing this as fixed.

Simon Goldschmidt <goldsimon>
Group administrator
Tue 29 May 2007 11:06:28 AM UTC, comment #4: 

Version 1.57 (my first fix) had a bug, please make sure you update to tcp.c file version 1.58!

Simon Goldschmidt <goldsimon>
Group administrator
Tue 22 May 2007 08:48:57 PM UTC, comment #3: 

I included a new pcb list, tcp_bound_pcbs like int the patch file #12540, only there is one more tcp_pcb_remove necessary in plus to the patch: in tcp_close() if pcb->state == CLOSED.

Thus we come to a behaviour like this.

Add pcbs to the list in tcp_bind
Remove pcbs from the list in
- tcp_close
- tcp_listen
- tcp_connect

Checked it in -> ready for test!

Simon Goldschmidt <goldsimon>
Group administrator
Fri 20 Apr 2007 09:42:38 PM UTC, comment #2: 

Unfortunately, I can't access http://www.sics.se/mailing-lists/lwip.html/msg01467.html

It seems a little outdated...

So I created my own patch including a new list of bound, unconnected tcp_pcbs as stated in comment #1:

(file #12540)

Simon Goldschmidt <goldsimon>
Group administrator
Tue 17 Apr 2007 11:50:12 AM UTC, comment #1: 

Do you plan to create a list of allocated tcp_pcbs in state CLOSED? I think this is the simplest solution, although I'm not sure about the amount of changes needed...

Maybe this is enough:
- call TCP_REG(tcp_pcbs_closed, newpcb) in tcp_new()
- call tcp_pcb_remove(tcp_pcbs_closed, pcb) in tcp_connect() and tcp_listen()

and then test tcp_pcbs_closed when binding. What do you think?

Simon Goldschmidt <goldsimon>
Group administrator
Thu 05 Dec 2002 10:03:02 AM UTC, original submission:  

some applications use POSIX bind() to reserve a port or check if a port is unused. Hence if a socket is created, and then bound to a port, no other subsequent bind to the same port should succeed.

This is not the case with tcp_bind, since it does not record the binding until tcp_connect or tcp_listen is done.

(This was reported to the mailing list with a patch by Paul Sheer - http://www.sics.se/mailing-lists/lwip.html/msg01467.html)

Kieran Mansley <kieranm>
Group Member

 

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

Attached Files
file #12540:  tcp_bind1.patch added by goldsimon (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-06-01 goldsimon StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2007-05-22 goldsimon StatusNone Ready For Test
        Assigned toNone goldsimon
    2007-04-20 goldsimon Attached File- Added tcp_bind1.patch, #12540
    2003-05-07 likewise CategoryNone None
        Item GroupNone None

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code