[BACK]Return to channels.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/channels.c between version 1.225 and 1.226

version 1.225, 2005/10/10 10:23:08 version 1.226, 2005/10/11 23:37:37
Line 1229 
Line 1229 
         xfree(remote_ipaddr);          xfree(remote_ipaddr);
 }  }
   
   static void
   channel_set_reuseaddr(int fd)
   {
           int on = 1;
   
           /*
            * Set socket options.
            * Allow local port reuse in TIME_WAIT.
            */
           if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1)
                   error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno));
   }
   
 /*  /*
  * This socket is listening for connections to a forwarded TCP/IP port.   * This socket is listening for connections to a forwarded TCP/IP port.
  */   */
Line 2185 
Line 2198 
     const char *host_to_connect, u_short port_to_connect, int gateway_ports)      const char *host_to_connect, u_short port_to_connect, int gateway_ports)
 {  {
         Channel *c;          Channel *c;
         int sock, r, success = 0, on = 1, wildcard = 0, is_client;          int sock, r, success = 0, wildcard = 0, is_client;
         struct addrinfo hints, *ai, *aitop;          struct addrinfo hints, *ai, *aitop;
         const char *host, *addr;          const char *host, *addr;
         char ntop[NI_MAXHOST], strport[NI_MAXSERV];          char ntop[NI_MAXHOST], strport[NI_MAXSERV];
Line 2272 
Line 2285 
                         verbose("socket: %.100s", strerror(errno));                          verbose("socket: %.100s", strerror(errno));
                         continue;                          continue;
                 }                  }
                 /*  
                  * Set socket options.  
                  * Allow local port reuse in TIME_WAIT.  
                  */  
                 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on,  
                     sizeof(on)) == -1)  
                         error("setsockopt SO_REUSEADDR: %s", strerror(errno));  
   
                   channel_set_reuseaddr(sock);
   
                 debug("Local forwarding listening on %s port %s.", ntop, strport);                  debug("Local forwarding listening on %s port %s.", ntop, strport);
   
                 /* Bind the socket to the address. */                  /* Bind the socket to the address. */
Line 2685 
Line 2693 
                                 freeaddrinfo(aitop);                                  freeaddrinfo(aitop);
                                 return -1;                                  return -1;
                         }                          }
                           channel_set_reuseaddr(sock);
                         if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {                          if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
                                 debug2("bind port %d: %.100s", port, strerror(errno));                                  debug2("bind port %d: %.100s", port, strerror(errno));
                                 close(sock);                                  close(sock);

Legend:
Removed from v.1.225  
changed lines
  Added in v.1.226