buglwIP - A Lightweight TCP/IP stack - Bugs: bug #21080, tcp_bind without check pcbs in...

 
 

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

bug #21080: tcp_bind without check pcbs in TIME_WAIT state

Submitter:  Oleg Tyshev <olegreen>
Submitted:  Fri 14 Sep 2007 03:36:17 PM 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

Thu 20 Sep 2007 06:28:51 PM UTC, comment #3: 

Fixed by including the check suggested by oleg

Simon Goldschmidt <goldsimon>
Group administrator
Thu 20 Sep 2007 04:01:26 PM UTC, comment #2: 

Yep. Anyone against me implementing this? (with a @todo directing to the task)

Simon Goldschmidt <goldsimon>
Group administrator
Sat 15 Sep 2007 07:08:14 AM UTC, comment #1: 

The idea seems correct.

Frédéric Bernon <fbernon>
Group Member
Fri 14 Sep 2007 03:36:17 PM UTC, original submission:  

In revision 1.32 of the file tcp.c was introduced
conditional switch SO_REUSE and following code

  for(cpcb = tcp_tw_pcbs; cpcb != NULL; cpcb = cpcb->next) {
    if(cpcb->local_port == port) {
      if(ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
        if(!(pcb->so_options & SOF_REUSEADDR) && !(pcb->so_options & SOF_REUSEPORT)) {
          LWIP_DEBUGF(TCP_DEBUG, ("tcp_bind: in TIME_WAIT PCB's SO_REUSEPORT or SO_REUSEADDR not set and same address.\n"));
          return ERR_USE;
        }
        else if(pcb->so_options & SOF_REUSEPORT) {
          LWIP_DEBUGF(TCP_DEBUG, ("tcp_bind: in TIME_WAIT PCB's SO_REUSEPORT set and same address.\n"));
          reuse_port_all_set = (reuse_port_all_set && (cpcb->so_options & SOF_REUSEPORT));
        }
      }
    }
  }
Later, all that had any connection to SO_REUSEADDR was deleted.
We have now only task #6995: Implement SO_REUSEADDR
https://savannah.nongnu.org/task/?6995


But if we don not support SO_REUSEADDR now,
we should check tcp_tw_pcbs list too.
Tcp_bind should contain something like that:

  for (cpcb = tcp_tw_pcbs;
       cpcb != NULL; cpcb = cpcb->next) {
    if (cpcb->local_port == port &&
        ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
      return ERR_USE;
    }
  }

Oleg Tyshev <olegreen>

 

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

Attached Files
file #13945:  tcp_bind.patch added by olegreen (492B - 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)
  • -email is unavailable- added by fbernon (Posted a comment)
  • -email is unavailable- added by olegreen (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-09-20 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2007-09-14 olegreen Attached File- Added tcp_bind.patch, #13945

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code