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
This commit is contained in:
parent
7293793c1a
commit
abdcdfd3fc
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user