(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.52 and 1.53

version 1.52, 2007/06/26 20:26:13 version 1.53, 2007/07/10 19:59:55
Line 531 
Line 531 
 // 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 540 
Line 540 
     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 553 
Line 554 
             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 563 
Line 564 
                 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 587 
Line 590 
             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 597 
Line 600 
                 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.52  
changed lines
  Added in v.1.53

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2