lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #21080] tcp_bind without check pcbs in TIME_WAIT state


From: Oleg Tyshev
Subject: [lwip-devel] [bug #21080] tcp_bind without check pcbs in TIME_WAIT state
Date: Fri, 14 Sep 2007 15:36:18 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

URL:
  <http://savannah.nongnu.org/bugs/?21080>

                 Summary: tcp_bind without check pcbs in TIME_WAIT state
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: olegreen
            Submitted on: Friday 09/14/2007 at 15:36
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 

    _______________________________________________________

Details:

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;
    }
  }




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Friday 09/14/2007 at 15:36  Name: tcp_bind.patch  Size: 492B   By:
olegreen

<http://savannah.nongnu.org/bugs/download.php?file_id=13945>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?21080>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]