ipv6 fix: toIP

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6306 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2010-06-02 08:01:31 +00:00
parent 37d6685e3c
commit f0c90622d0

View File

@ -3661,18 +3661,16 @@ sub getSNformattedhash
sub toIP
{
# does not support IPV6 IPV6TODO
if ($_[0] =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/)
if (($_[0] =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) || ($_[0] =~ /:/))
{
return ([0, $_[0]]);
}
$!=undef;
my $packed_ip = gethostbyname($_[0]);
if (!$packed_ip or $!)
my $ip = xCAT::NetworkUtils->getipaddr($_[0]);
if (!$ip)
{
return ([1, "Cannot Resolve: $_[0]\n"]);
}
return ([0, inet_ntoa($packed_ip)]);
return ([0, $ip]);
}
#-----------------------------------------------------------------------------