in some older AIX versions, the Socket6.pm is not available, but will have IPv6 address ::1 configured on loopback, need to avoid passing ipv6 address to inet_* calls
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6103 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -140,6 +140,12 @@ sub gethostname() | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             #it is possible that no Socket6 available, | ||||
|             #but passing in IPv6 address, such as ::1 on loopback | ||||
|             if ($iporhost =~ /:/) | ||||
|             { | ||||
|                 return undef; | ||||
|             } | ||||
|             my $hostname = gethostbyaddr(inet_aton($iporhost), AF_INET); | ||||
|             $hostname =~ s/\..*//; #short hostname | ||||
|             return $hostname; | ||||
| @@ -207,6 +213,7 @@ sub getipaddr() | ||||
|         else | ||||
|         { | ||||
|              #return inet_ntoa(inet_aton($iporhost)) | ||||
|              #TODO, what if no scoket6 support, but passing in a IPv6 hostname? | ||||
|              my $packed_ip = inet_aton($iporhost); | ||||
|              if (!$packed_ip) | ||||
|              { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user