From d33c3d4443ca0d3310824a46f3d9c37d8273cb84 Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 14 May 2010 01:36:40 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/NetworkUtils.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 828c26bce..4393d06e0 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -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) {