/[svn]/ircd-hybrid/branches/8.2.x/src/listener.c
ViewVC logotype

Diff of /ircd-hybrid/branches/8.2.x/src/listener.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9994 by michael, Thu Jun 17 15:18:57 2021 UTC revision 9995 by michael, Thu Jun 17 16:20:00 2021 UTC
# Line 358  listener_release(struct Listener *listen Line 358  listener_release(struct Listener *listen
358  void  void
359  listener_add(int port, const char *vhost_ip, unsigned int flags)  listener_add(int port, const char *vhost_ip, unsigned int flags)
360  {  {
   struct Listener *listener;  
361    struct irc_ssaddr vaddr;    struct irc_ssaddr vaddr;
362    struct addrinfo hints, *res;    struct addrinfo hints, *res;
363    char portname[PORTNAMELEN + 1];    char portname[PORTNAMELEN + 1];
# Line 371  listener_add(int port, const char *vhost Line 370  listener_add(int port, const char *vhost
370    if (!(port > 0 && port <= 0xFFFF))    if (!(port > 0 && port <= 0xFFFF))
371      return;      return;
372    
   memset(&vaddr, 0, sizeof(vaddr));  
   
373    /* Set up the hints structure */    /* Set up the hints structure */
374    memset(&hints, 0, sizeof(hints));    memset(&hints, 0, sizeof(hints));
375    hints.ai_family = AF_UNSPEC;    hints.ai_family = AF_UNSPEC;
# Line 380  listener_add(int port, const char *vhost Line 377  listener_add(int port, const char *vhost
377    /* Get us ready for a bind() and don't bother doing dns lookup */    /* Get us ready for a bind() and don't bother doing dns lookup */
378    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;    hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
379    
   /* TBD: This makes no sense here at all. Needs to be reworked */  
   
380    snprintf(portname, sizeof(portname), "%d", port);    snprintf(portname, sizeof(portname), "%d", port);
   getaddrinfo("::", portname, &hints, &res);  
   vaddr.ss.ss_family = AF_INET6;  
381    
382      getaddrinfo("::", portname, &hints, &res);
383    assert(res);    assert(res);
384    
385    memcpy((struct sockaddr*)&vaddr, res->ai_addr, res->ai_addrlen);    memcpy((struct sockaddr *)&vaddr, res->ai_addr, res->ai_addrlen);
386    vaddr.ss_len = res->ai_addrlen;    vaddr.ss_len = res->ai_addrlen;
387    freeaddrinfo(res);    freeaddrinfo(res);
 #ifdef MAKES_NO_SENSE  
   {  
     struct sockaddr_in *v4 = (struct sockaddr_in*) &vaddr;  
     v4->sin_addr.s_addr = INADDR_ANY;  
     vaddr.ss.ss_family = AF_INET;  
     vaddr.ss_len = sizeof(struct sockaddr_in);  
     v4->sin_port = htons(port);  
   }  
 #endif  
   
   snprintf(portname, PORTNAMELEN, "%d", port);  
388    
389    if (!EmptyString(vhost_ip))    if (!EmptyString(vhost_ip))
390    {    {
# Line 410  listener_add(int port, const char *vhost Line 393  listener_add(int port, const char *vhost
393    
394      assert(res);      assert(res);
395    
396      memcpy((struct sockaddr*)&vaddr, res->ai_addr, res->ai_addrlen);      memcpy((struct sockaddr *)&vaddr, res->ai_addr, res->ai_addrlen);
397      vaddr.ss_len = res->ai_addrlen;      vaddr.ss_len = res->ai_addrlen;
398      freeaddrinfo(res);      freeaddrinfo(res);
399    }    }
# Line 423  listener_add(int port, const char *vhost Line 406  listener_add(int port, const char *vhost
406    
407    pass = 0;    pass = 0;
408    
409    if ((listener = listener_find(port, &vaddr)))    struct Listener *listener = listener_find(port, &vaddr);
410      if (listener)
411    {    {
412      listener->flags = flags;      listener->flags = flags;
413    

Legend:
Removed from v.9994  
changed lines
  Added in v.9995

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28