-Validate discovery source is in a dynamic range that xCAT controls

-Make MAC discovery contemplate the payload of a discovery packet rather than just contextual data


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3251 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-04-23 21:19:03 +00:00
parent ff63318516
commit b849ef83e7
3 changed files with 27 additions and 13 deletions

View File

@ -2143,7 +2143,6 @@ sub process_request {
last;
}
}
unless ($mac) { return };
#Only refresh the the cache when the request permits and no useful answer
if ($macmaptimestamp < (time() - 300)) { #after five minutes, invalidate cache
@ -2158,7 +2157,19 @@ sub process_request {
process_request(\%invreq,\&fillresps);
}
}
unless ($macmap{$mac}) {
my $found=0;
if ($mac and $macmap{$mac}) {
$found=1;
} else {
foreach (@{$request->{mac}}) {
/.*\|.*\|([\dABCDEFabcdef:]+)(\||$)/;
if ($1 and $macmap{$1}) {
$found=1;
last;
}
}
}
unless ($found) {
return 1; #failure
}
my $mactab = xCAT::Table->new('mac',-create=>1);

View File

@ -37,17 +37,20 @@ sub process_request {
last;
}
}
unless ($mac) {
return;
my $node;
my $firstpass=1;
if ($mac) {
$node = $macmap->find_mac($mac,$req->{cacheonly}->[0]);
$firstpass=0;
}
if (not $node) { # and $req->{checkallmacs}->[0]) {
foreach (@{$req->{mac}}) {
/.*\|.*\|([\dABCDEFabcdef:]+)(\||$)/;
$node = $macmap->find_mac($1,$firstpass);
$firstpass=0;
if ($node) { last; }
}
}
my $node = $macmap->find_mac($mac,$req->{cacheonly}->[0]);
#if (not $node and $req->{checkallmacs}->[0]) {
# foreach (@{$req->{mac}}) {
# /.*\|.*\|([\dABCDEFabcdef:]+)(\||$)/;
# $node = $macmap->find_mac($1,$req->{cacheonly}->[0]);
# if ($node) { last; }
# }
#}
if ($node) {
my $mactab = xCAT::Table->new('mac',-create=>1);

View File

@ -357,7 +357,7 @@ if ($inet6support) {
$req->{'_xcat_clienthost'}=gethostbyaddr($client,AF_INET);
$req->{'_xcat_clientip'}=inet_ntoa($client);
$req->{'_xcat_clientport'}=$sport;
if (defined($cmd_handlers{"findme"})) {
if (defined($cmd_handlers{"findme"}) and xCAT::Utils->nodeonmynet(inet_ntoa($client))) { #only discover from ips that appear to be on a managed network
$req->{cacheonly}->[0] = 1;
plugin_command($req,undef,\&build_response);
if ($req->{cacheonly}->[0]) {