X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PlanetLabConf%2Fsysctl.php;h=a17d80cbeabc7a3cc5bc7394ff4d33898ef12cc2;hb=b815095fec39d567d31901c610de18c611dd5db5;hp=127362e9cbb703f7b35a19369087efd29a4321dd;hpb=e9b0065a02763ed6ba0d6499c8d4fc723eb3a410;p=nodeconfig.git diff --git a/PlanetLabConf/sysctl.php b/PlanetLabConf/sysctl.php index 127362e..a17d80c 100755 --- a/PlanetLabConf/sysctl.php +++ b/PlanetLabConf/sysctl.php @@ -15,12 +15,27 @@ global $adm; $ip_forward = 0; // Look up the node -$interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +// 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]; - $interfaces = $adm->GetInterfaces($node['interface_ids']); + 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.