Fix networkutils to work with CIDR again

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16297 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2013-05-14 15:28:11 +00:00
parent 60609b1b24
commit 6839048a17

View File

@ -422,11 +422,6 @@ sub ishostinsubnet {
if ($ip =~ /:/) {#ipv6
$numbits=128;
}
# IPv6 subnet with netmask postfix like /64
if ($subnet && ($subnet =~ /\//))
{
$subnet =~ s/\/.*$//;
}
if ($mask) {
if ($mask =~ /\//) {
$mask =~ s/^\///;
@ -442,6 +437,10 @@ sub ishostinsubnet {
die "ishostinsubnet must either be called with a netmask or CIDR /bits notation";
}
}
if ($subnet && ($subnet =~ /\//)) #remove CIDR suffix from subnet
{
$subnet =~ s/\/.*$//;
}
$ip = getipaddr($ip,GetNumber=>1);
$subnet = getipaddr($subnet,GetNumber=>1);
$ip &= $mask;