ipv6 fix, replace the Socket library calls with NetworkUtils subroutines

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6060 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2010-05-11 14:03:58 +00:00
parent d21b54c9fb
commit d75d747b19

View File

@ -101,6 +101,15 @@ sub gethostname()
{
my ($class, $iporhost) = @_;
if (ref($iporhost) eq 'ARRAY')
{
$iporhost = @{$iporhost}[0];
if (!$iporhost)
{
return undef;
}
}
my $socket6support = eval { require Socket6 };
if (($iporhost !~ /\d+\.\d+\.\d+\.\d+/) && ($iporhost !~ /:/))
@ -163,6 +172,14 @@ sub getipaddr()
{
my ($class, $iporhost) = @_;
if (ref($iporhost) eq 'ARRAY')
{
$iporhost = @{$iporhost}[0];
if (!$iporhost)
{
return undef;
}
}
my $socket6support = eval { require Socket6 };
if (($iporhost =~ /\d+\.\d+\.\d+\.\d+/) || ($iporhost =~ /:/))
@ -189,7 +206,13 @@ sub getipaddr()
}
else
{
return inet_ntoa(inet_aton($iporhost))
#return inet_ntoa(inet_aton($iporhost))
my $packed_ip = inet_aton($iporhost);
if (!$packed_ip)
{
return undef;
}
return inet_ntoa($packed_ip);
}
}
}