From: Marc Fiuczynski Date: Fri, 14 May 2010 19:11:06 +0000 (+0000) Subject: Added support to look up statically NAT'd nodes by their public_ip_address InterfaceTag X-Git-Tag: nodeconfig-4.3-8~2 X-Git-Url: http://git.onelab.eu/?p=nodeconfig.git;a=commitdiff_plain;h=c5ac05a3daa5e84494b410b5bf954e57361d56d2 Added support to look up statically NAT'd nodes by their public_ip_address InterfaceTag --- diff --git a/boot/upload-bmlog.php b/boot/upload-bmlog.php index 6e29e23..0b22d4f 100755 --- a/boot/upload-bmlog.php +++ b/boot/upload-bmlog.php @@ -28,6 +28,18 @@ $ip = $_SERVER['REMOTE_ADDR']; $hostname=$default_hostname; // locate hostname from DB based on this IP $interfaces=$adm->GetInterfaces(array("ip"=>$ip)); + +if (empty($interfaces) ) { // maybe its a node with a NAT'd IP addresses + // look up an interface tag using the public IP address value + $interfacetags=$adm->GetInterfaceTags(array("tagname"=>"public_ip_address","value"=>$ip)); + if (! empty($interfacetags)) { + // using the interface_id now get the interface with the node_id information + $interface_id=$interfacetags[0]['interface_id']; + $interfaces=$adm->GetInterfaces($interface_id); + // fall thru to the conditional below ... + } + } + if (! empty($interfaces) ) { $interface=$interfaces[0]; $node_id=$interface['node_id'];