X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PlanetLabConf%2Fsysctl.php;h=a17d80cbeabc7a3cc5bc7394ff4d33898ef12cc2;hb=b815095fec39d567d31901c610de18c611dd5db5;hp=edd8e869c51fbb141824c55a0b45b65a199b99b2;hpb=37a93603272c00a8b2389bbec0c1860382eb8569;p=nodeconfig.git diff --git a/PlanetLabConf/sysctl.php b/PlanetLabConf/sysctl.php index edd8e86..a17d80c 100755 --- a/PlanetLabConf/sysctl.php +++ b/PlanetLabConf/sysctl.php @@ -15,16 +15,31 @@ global $adm; $ip_forward = 0; // Look up the node -$nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); -if (!empty($nodenetworks)) { - $nodes = $adm->GetNodes(array($nodenetworks[0]['node_id'])); +// backwards compatibility with the old 4.2 API +global $__PLC_API_VERSION; +if ( ! method_exists ($adm,"GetInterfaces")) + $__PLC_API_VERSION = 4.2; +else + $__PLC_API_VERSION = 4.3; + +if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); +else + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); + +if (!empty($interfaces)) { + $nodes = $adm->GetNodes(array($interfaces[0]['node_id'])); if (!empty($nodes)) { $node = $nodes[0]; - $nodenetworks = $adm->GetNodeNetworks($node['nodenetwork_ids']); - foreach ($nodenetworks as $nodenetwork) { + if ($__PLC_API_VERSION==4.2) + $interfaces = $adm->GetInterfaces($node['nodenetwork_ids']); + else + $interfaces = $adm->GetInterfaces($node['interface_ids']); + + foreach ($interfaces as $interface) { // Nodes with proxy socket interfaces need to be able to forward // between the fake proxy0 interface and the real interface. - if ($nodenetwork['method'] == 'proxy') { + if ($interface['method'] == 'proxy') { $ip_forward = 1; break; }