-Fix mistake in previous checkin
-Implement 'nodeonmynet' ipv6 linux git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8687 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
21a13159e0
commit
737779fc4a
@ -347,15 +347,15 @@ sub ishostinsubnet {
|
||||
if ($mask) {
|
||||
$mask=getipaddr($mask,GetNumber=>1);
|
||||
} else { #CIDR notation supported
|
||||
if ($ip =~ /\//) {
|
||||
($ip,$mask) = split /\//,$ip,2;
|
||||
if ($subnet =~ /\//) {
|
||||
($subnet,$mask) = split /\//,$subnet,2;
|
||||
$mask=Math::BigInt->new("0b".("1"x$mask).("0"x($numbits-$mask)));
|
||||
} else {
|
||||
die "ishostinsubnet must either be called with a netmask or CIDR /bits notation";
|
||||
}
|
||||
}
|
||||
$ip = getipaddr($ip,GetNumber=>1);
|
||||
$subnet = getipaddr($ip,GetNumber=>1);
|
||||
$subnet = getipaddr($subnet,GetNumber=>1);
|
||||
$ip &= $mask;
|
||||
if ($ip == $subnet) {
|
||||
return 1;
|
||||
|
@ -2704,8 +2704,20 @@ sub nodeonmynet
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
my @v6routes = split /\n/,`ip -6 route`;
|
||||
foreach (@v6routes) {
|
||||
if (/via/ or /^unreachable/ or /^fe80::\/64/) { #only count local ones, remote ones can be caught in next loop
|
||||
#also, link-local would be a pitfall, since more context than address is
|
||||
#needed to determine locality
|
||||
next;
|
||||
}
|
||||
s/ .*//; #remove all after the space
|
||||
if (xCAT::NetworkUtils->ishostinsubnet($nodeip,'',$_)) { #bank on CIDR support
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#TODO, ipv6 on Linux
|
||||
my $nettab=xCAT::Table->new("networks");
|
||||
my @vnets = $nettab->getAllAttribs('net','mgtifname','mask');
|
||||
foreach (@vnets) {
|
||||
|
Loading…
Reference in New Issue
Block a user