diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index c17c785e6..b0d90ae3f 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -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;