updated the more general ntp.conf.de to contain the rwth-aachen.de server
[nodeconfig.git] / PlanetLabConf / sysctl-ip_forward.php
1 <?php
2 //
3 // $Id$
4 //
5
6 // Get admin API handle
7 require_once 'plc_api.php';
8 global $adm;
9
10 $ip_forward = 0;
11
12 // Look up the node
13 // backwards compatibility with the old 4.2 API
14 global $__PLC_API_VERSION;
15 if ( ! method_exists ($adm,"GetInterfaces"))
16   $__PLC_API_VERSION = 4.2;
17 else
18   $__PLC_API_VERSION = 4.3;
19
20 if ($__PLC_API_VERSION==4.2)
21   $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR']));
22 else
23   $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
24
25 if (!empty($interfaces)) {
26   $nodes = $adm->GetNodes(array($interfaces[0]['node_id']));
27   if (!empty($nodes)) {
28     $node = $nodes[0];
29     if ($__PLC_API_VERSION==4.2)
30       $interfaces = $adm->GetInterfaces($node['nodenetwork_ids']);
31     else
32       $interfaces = $adm->GetInterfaces($node['interface_ids']);
33
34     foreach ($interfaces as $interface) {
35       // Nodes with proxy socket interfaces need to be able to forward
36       // between the fake proxy0 interface and the real interface.
37       if ($interface['method'] == 'proxy') {
38         $ip_forward = 1;
39         break;
40       }
41     }
42   }
43 }
44
45 ?>
46
47 # $Id$
48 #
49 # sysctl configuration file to optionally enable/disable IP forwarding
50 #
51 # For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
52 # sysctl.conf(5) for more details.
53 #
54 # This file is generated by NodeManager Configuration Files... 
55 # do not manually edit
56 #
57
58 # Controls IP packet forwarding
59 net.ipv4.ip_forward = <?php echo $ip_forward; ?>