From dd0e3f7f3521d42f46d12fdaa8622a915a6512b0 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 10 May 2010 08:23:59 +0000 Subject: [PATCH] ipv6 fix, replace the Socket library calls with NetworkUtils subroutines git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6038 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/InstUtils.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/InstUtils.pm b/perl-xCAT/xCAT/InstUtils.pm index 6139c277a..abb2b8273 100644 --- a/perl-xCAT/xCAT/InstUtils.pm +++ b/perl-xCAT/xCAT/InstUtils.pm @@ -83,10 +83,9 @@ sub getnimprime my $hostname; if ($nimprime) { - if ($nimprime =~ /\d+\.\d+\.\d+\.\d+/) + if (($nimprime =~ /\d+\.\d+\.\d+\.\d+/) || ($nimprime =~ /:/)) { - my $packedaddr = inet_aton($nimprime); - $hostname = gethostbyaddr($packedaddr, AF_INET); + $hostname = xCAT::NetworkUtils->gethostname($nimprime); } else { @@ -125,10 +124,9 @@ sub myxCATname # read the site table, master attrib my $hostname = xCAT::Utils->get_site_Master(); - if ($hostname =~ /\d+\.\d+\.\d+\.\d+/) + if (($hostname =~ /\d+\.\d+\.\d+\.\d+/) || ($hostname =~ /:/)) { - my $packedaddr = inet_aton($hostname); - $name = gethostbyaddr($packedaddr, AF_INET); + $name = xCAT::NetworkUtils->gethostname($hostname); } else { @@ -640,7 +638,7 @@ sub get_server_nodes { # get ip of node xcatmaster attribute my $xcatmaster = $xcatmasters->{$node}->[0]->{xcatmaster}; - $serv = inet_ntoa(inet_aton($xcatmaster)); + $serv = xCAT::NetworkUtils->getipaddr($xcatmaster); } else {