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

Submitted by:  Kieran Mansley <kieranm>
Submitted on:  Thu 05 Dec 2002 10:03:02 AM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: None

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

Closing this as fixed.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project Administrator

 

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
  • -unavailable- added by goldsimon (Posted a comment)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 01 Jun 2007 04:03:10 PM UTCgoldsimonStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Tue 22 May 2007 08:48:57 PM UTCgoldsimonStatusNone=>Ready For Test
      Assigned toNone=>goldsimon
    Fri 20 Apr 2007 09:42:38 PM UTCgoldsimonAttached File-=>Added tcp_bind1.patch, #12540
    Wed 07 May 2003 08:47:44 PM UTClikewiseCategoryNone=>(Error - Not Found)
      Item GroupNone=>(Error - Not Found)

    Back to the top


    Powered by Savane 3.1-cleanup1