ipv6 fix, replace the Socket library calls with NetworkUtils subroutines

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6064 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2010-05-12 02:30:25 +00:00
parent 460ebac96d
commit 4de6fcf10b

View File

@ -3050,23 +3050,42 @@ sub gethost_ips
my @ip;
if (xCAT::Utils->isLinux())
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
@ip = split(":", $addr1);
push @ipaddress, $ip[1];
if ($addr =~ /inet6/)
{
#TODO, Linux ipv6
}
else
{
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
@ip = split(":", $addr1);
push @ipaddress, $ip[1];
}
}
else
{ #AIX
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
split(" ", $addr);
push @ipaddress, $addr1;
if ($addr =~ /inet6/)
{
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
my $v6ip = $1;
my $v6mask = $2;
if ($v6ip)
{
push @ipaddress, $v6ip;
}
}
else
{
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
split(" ", $addr);
push @ipaddress, $addr1;
}
}
}
my @names = @ipaddress;
foreach my $ipaddr (@names)
{
my $packedaddr = inet_aton($ipaddr);
my $hostname = gethostbyaddr($packedaddr, AF_INET);
my $hostname = xCAT::NetworkUtils->gethostname($ipaddr);
if ($hostname)
{
my @shorthost = split(/\./, $hostname);