(file) Return to System.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/System.cpp between version 1.47.4.2 and 1.47.4.3

version 1.47.4.2, 2007/07/03 21:50:04 version 1.47.4.3, 2007/07/11 22:14:16
Line 575 
Line 575 
 // Get all ip addresses on the node and compare them with the given hostname. // Get all ip addresses on the node and compare them with the given hostname.
 #ifdef PEGASUS_ENABLE_IPV6 #ifdef PEGASUS_ENABLE_IPV6
     CString csName = hostName.getCString();     CString csName = hostName.getCString();
     struct addrinfo hints, *res1, *res2;      struct addrinfo hints, *res1, *res2, *res1root, *res2root;
     char localHostName[PEGASUS_MAXHOSTNAMELEN];     char localHostName[PEGASUS_MAXHOSTNAMELEN];
     gethostname(localHostName, PEGASUS_MAXHOSTNAMELEN);     gethostname(localHostName, PEGASUS_MAXHOSTNAMELEN);
     Boolean isLocal = false;     Boolean isLocal = false;
Line 584 
Line 584 
     hints.ai_family = AF_INET;     hints.ai_family = AF_INET;
     hints.ai_socktype = SOCK_STREAM;     hints.ai_socktype = SOCK_STREAM;
     hints.ai_protocol = IPPROTO_TCP;     hints.ai_protocol = IPPROTO_TCP;
     res1 = res2 = 0;      res1root = res2root = 0;
     getaddrinfo(csName, 0, &hints, &res1);      getaddrinfo(csName, 0, &hints, &res1root);
     getaddrinfo(localHostName, 0, &hints, &res2);      getaddrinfo(localHostName, 0, &hints, &res2root);
  
       res1 = res1root;
     while (res1 && !isLocal)     while (res1 && !isLocal)
     {     {
         if (isLoopBack(AF_INET,         if (isLoopBack(AF_INET,
Line 597 
Line 598 
             break;             break;
         }         }
  
         struct addrinfo *tmp = res2;          res2 = res2root;
         while (tmp)          while (res2)
         {         {
             if (!memcmp(&((struct sockaddr_in*)res1->ai_addr)->sin_addr,             if (!memcmp(&((struct sockaddr_in*)res1->ai_addr)->sin_addr,
                 &((struct sockaddr_in*)res2->ai_addr)->sin_addr,                 &((struct sockaddr_in*)res2->ai_addr)->sin_addr,
Line 607 
Line 608 
                 isLocal = true;                 isLocal = true;
                 break;                 break;
             }             }
             tmp = tmp->ai_next;              res2 = res2->ai_next;
         }         }
         res1 = res1->ai_next;         res1 = res1->ai_next;
     }     }
     freeaddrinfo(res1);      freeaddrinfo(res1root);
     freeaddrinfo(res2);      freeaddrinfo(res2root);
     if (isLocal)     if (isLocal)
     {     {
         return true;         return true;
     }     }
  
     hints.ai_family = AF_INET6;     hints.ai_family = AF_INET6;
     res1 = res2 = 0;      res1root = res2root = 0;
     getaddrinfo(csName, 0, &hints, &res1);      getaddrinfo(csName, 0, &hints, &res1root);
     getaddrinfo(localHostName, 0, &hints, &res2);      getaddrinfo(localHostName, 0, &hints, &res2root);
   
       res1 = res1root;
     while (res1 && !isLocal)     while (res1 && !isLocal)
     {     {
         if (isLoopBack(AF_INET6,         if (isLoopBack(AF_INET6,
Line 631 
Line 634 
             break;             break;
         }         }
  
         struct addrinfo *tmp = res2;          res2 = res2root;
         while (tmp)          while (res2)
         {         {
             if (!memcmp(&((struct sockaddr_in6*)res1->ai_addr)->sin6_addr,             if (!memcmp(&((struct sockaddr_in6*)res1->ai_addr)->sin6_addr,
                 &((struct sockaddr_in6*)res2->ai_addr)->sin6_addr,                 &((struct sockaddr_in6*)res2->ai_addr)->sin6_addr,
Line 641 
Line 644 
                 isLocal = true;                 isLocal = true;
                 break;                 break;
             }             }
             tmp = tmp->ai_next;              res2 = res2->ai_next;
         }         }
         res1 = res1->ai_next;         res1 = res1->ai_next;
     }     }
     freeaddrinfo(res1);      freeaddrinfo(res1root);
     freeaddrinfo(res2);      freeaddrinfo(res2root);
  
     return isLocal;     return isLocal;
 #else #else


Legend:
Removed from v.1.47.4.2  
changed lines
  Added in v.1.47.4.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2