ipv6 support for ishostinsubnet
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6015 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
7b1275b4ad
commit
0d4b44bc80
@ -22,6 +22,7 @@ use File::Path;
|
||||
use Socket;
|
||||
use strict;
|
||||
use warnings "all";
|
||||
my $netipmodule = eval {require Net::IP;};
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
|
||||
@ -289,7 +290,18 @@ sub ishostinsubnet {
|
||||
return 0;
|
||||
}
|
||||
} else { # for ipv6
|
||||
#todo
|
||||
if ($netipmodule) {
|
||||
my $eip = Net::IP::ip_expand_address ($ip,6);
|
||||
my $enet = Net::IP::ip_expand_address ($subnet,6);
|
||||
my $bmask = Net::IP::ip_get_mask($mask,6);
|
||||
my $bip = Net::IP::ip_iptobin($eip,6);
|
||||
my $bipnet = $bip & $bmask;
|
||||
my $bnet = Net::IP::ip_iptobin($enet,6);
|
||||
if ($bipnet == $bnet) {
|
||||
return 1;
|
||||
}
|
||||
} # else, can not check without Net::IP module
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user