ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/server.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/server.c (file contents):
Revision 8869 by michael, Sat Feb 16 10:32:41 2019 UTC vs.
Revision 8872 by michael, Sat Feb 16 21:49:34 2019 UTC

# Line 389 | Line 389 | server_connect(struct MaskItem *conf, st
389    assert(conf->type == CONF_SERVER);
390    assert(hash_find_server(conf->name) == NULL);  /* This should have been checked by the caller */
391  
392  getnameinfo((const struct sockaddr *)&conf->addr, conf->addr.ss_len,
393              buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
394  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, conf->host, buf);
395
392    /* Still processing a DNS lookup? -> exit */
393    if (conf->dns_pending == true)
394    {
# Line 410 | Line 406 | server_connect(struct MaskItem *conf, st
406      return false;
407    }
408  
409 +  getnameinfo((const struct sockaddr *)conf->addr, conf->addr->ss_len,
410 +              buf, sizeof(buf), NULL, 0, NI_NUMERICHOST);
411 +  ilog(LOG_TYPE_IRCD, "Connect to %s[%s] @%s", conf->name, conf->host, buf);
412 +
413    /* Create a socket for the server connection */
414 <  int fd = comm_socket(conf->addr.ss.ss_family, SOCK_STREAM, 0);
414 >  int fd = comm_socket(conf->addr->ss.ss_family, SOCK_STREAM, 0);
415    if (fd == -1)
416    {
417      /* Eek, failure to create the socket */
# Line 429 | Line 429 | server_connect(struct MaskItem *conf, st
429    /* We already converted the ip once, so lets use it - stu */
430    strlcpy(client_p->sockhost, buf, sizeof(client_p->sockhost));
431  
432 +  memcpy(&client_p->ip, conf->addr, sizeof(client_p->ip));
433 +
434    client_p->connection->fd = fd_open(fd, true, NULL);
435  
436    /* Server names are always guaranteed under HOSTLEN chars */
# Line 448 | Line 450 | server_connect(struct MaskItem *conf, st
450      strlcpy(client_p->serv->by, "AutoConn.", sizeof(client_p->serv->by));
451  
452    SetConnecting(client_p);
451  client_p->ip.ss.ss_family = conf->aftype;
453  
454    /* Now, initiate the connection */
455 <  /* XXX assume that a non 0 type means a specific bind address
456 <   * for this connect.
456 <   */
457 <  switch (conf->aftype)
458 <  {
459 <    case AF_INET:
460 <      if (((struct sockaddr_in*)&conf->bind)->sin_addr.s_addr)
461 <        comm_connect_tcp(client_p->connection->fd, conf->host, conf->port,
462 <                         (struct sockaddr *)&conf->bind, conf->bind.ss_len,
463 <                         server_connect_callback, client_p, conf->aftype,
464 <                         CONNECTTIMEOUT);
465 <      else
466 <        comm_connect_tcp(client_p->connection->fd, conf->host, conf->port, NULL, 0,
467 <                         server_connect_callback, client_p, conf->aftype,
468 <                         CONNECTTIMEOUT);
469 <      break;
470 <    case AF_INET6:
471 <      if (IN6_IS_ADDR_UNSPECIFIED(&((struct sockaddr_in6 *)&conf->bind)->sin6_addr) == 0)
472 <        comm_connect_tcp(client_p->connection->fd, conf->host, conf->port,
473 <                         (struct sockaddr *)&conf->bind, conf->bind.ss_len,
474 <                         server_connect_callback, client_p, conf->aftype,
475 <                         CONNECTTIMEOUT);
476 <      else
477 <        comm_connect_tcp(client_p->connection->fd, conf->host, conf->port, NULL, 0,
478 <                         server_connect_callback, client_p, conf->aftype,
479 <                         CONNECTTIMEOUT);
480 <  }
455 >  comm_connect_tcp(client_p->connection->fd, conf->addr, conf->port, conf->bind,
456 >                   server_connect_callback, client_p, CONNECTTIMEOUT);
457  
458    /*
459     * At this point we have a connection in progress and a connect {} block

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)