From abdcdfd3fcd1726a2b2069f0a6a0d23a81c43b2b Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 10 May 2010 09:14:19 +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@6043 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Postage.pm | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index b573ec4f3..80b158185 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -510,9 +510,8 @@ sub getnodesetstate { sub net_parms { my $ip = shift; - if (inet_aton($ip)) { - $ip = inet_ntoa(inet_aton($ip)); - } else { + $ip = xCAT::NetworkUtils->getipaddr($ip); + if (!$ip) { xCAT::MsgUtils->message("S","Unable to resolve $ip"); return undef; } @@ -523,13 +522,7 @@ sub net_parms { my $net = $_->{'net'}; my $mask =$_->{'mask'}; my $gw = $_->{'gateway'}; - $ip =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/; - my $ipnum = ($1<<24)+($2<<16)+($3<<8)+$4; - $mask =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/; - my $masknum = ($1<<24)+($2<<16)+($3<<8)+$4; - $net =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/; - my $netnum = ($1<<24)+($2<<16)+($3<<8)+$4; - if (($ipnum & $masknum)==$netnum) { + if (xCAT::NetworkUtils->ishostinsubnet($ip, $mask, $gw)) { return ($ip,$mask,$gw); } }