2 # /etc/planetlab/proxies
4 # post: service vnet restart
6 # Proxy (a.k.a. network telescope a.k.a. honeypot) interface configuration
8 # Aaron Klingaman <alk@cs.princeton.edu>
9 # Mark Huang <mlhuang@cs.princeton.edu>
10 # Copyright (C) 2004 The Trustees of Princeton University
16 // Get admin API handle
17 require_once 'plc_api.php';
21 // backwards compatibility with the old 4.2 API
22 global $__PLC_API_VERSION;
23 if ( ! method_exists ($adm,"GetInterfaces"))
24 $__PLC_API_VERSION = 4.2;
26 $__PLC_API_VERSION = 4.3;
27 if ($__PLC_API_VERSION==4.2)
28 $interfaces = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR']));
30 $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR']));
32 if (!empty($interfaces)) {
33 $nodes = $adm->GetNodes(array($interfaces[0]['node_id']));
43 if ($__PLC_API_VERSION==4.2)
44 $interfaces = $adm->GetInterfaces($node['nodenetwork_ids']);
46 $interfaces = $adm->GetInterfaces($node['interface_ids']);
48 foreach ($interfaces as $interface) {
49 // XXX PL2896: need interfaces.device
50 switch ($interface['method']) {
53 $types['taps'][$dev][0] = $interface['ip'] . "/" . $interface['gateway'];
57 $types['proxies'][$dev][] = $interface['ip'];
62 // taps="tap0 tap1 ..."
63 // tap0="1.2.3.4/5.6.7.8"
64 // tap1="9.10.11.12/13.14.15.16"
66 // proxies="proxy0 proxy1 ..."
67 // proxy0="1.2.3.4 5.6.7.8 ..."
68 // proxy1="9.10.11.12 13.14.15.16 ..."
71 foreach ($types as $type => $devs) {
72 print("$type=\"" . implode(" ", array_keys($devs)) . "\"\n");
73 foreach ($devs as $dev => $ips) {
74 print("$dev=\"" . implode(" ", $ips) . "\"\n");