lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #6865] SO_REUSEADDR for TCP


From: Oleg Tyshev
Subject: [lwip-devel] [patch #6865] SO_REUSEADDR for TCP
Date: Tue, 16 Feb 2010 12:09:37 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB5

Follow-up Comment #15, patch #6865 (project lwip):

I see tcp_bind() and it always used
 ip_addr_isany(&(cpcb->local_ip))
check.

For bind pcb list and listen pcb list it is correct.
But for active pcb list and time_wait pcb list local port can't be ANY, so
this check is superfluous.

 /* Check the connected pcbs. */
  for(cpcb = tcp_active_pcbs;
      cpcb != NULL; cpcb = cpcb->next) {
    if (cpcb->local_port == port) {
-      if (ip_addr_isany(&(cpcb->local_ip)) ||
-          ip_addr_isany(ipaddr) ||
+      if (ip_addr_isany(ipaddr) ||
          ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
        return ERR_USE;
      }
    }
  }


  /* Unless the REUSEADDR flag is set,
   * we have to check the pcbs in TIME-WAIT state, also: */
  if ((pcb->so_options & SOF_REUSEADDR) == 0) {
    for(cpcb = tcp_tw_pcbs; cpcb != NULL; cpcb = cpcb->next) {
      if (cpcb->local_port == port) {
-        if (ip_addr_isany(&(cpcb->local_ip)) ||
-            ip_addr_isany(ipaddr) ||
+        if (ip_addr_isany(ipaddr) ||
            ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
          return ERR_USE;
        }
      }
    }
  }





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?6865>

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





reply via email to

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