'device', 'device' => $device['device_id'], 'tab' => 'routing', 'proto' => 'ipsec_tunnels' ); print_optionbar_start(); echo "IPSEC Tunnels » "; $menu_options = array( 'basic' => 'Basic' ); if (!isset($vars['view'])) { $vars['view'] = 'basic'; } echo "VRFs » "; $menu_options = array( 'basic' => 'Basic' ); if (!$_GET['opta']) { $_GET['opta'] = 'basic'; } $sep = ''; foreach ($menu_options as $option => $text) { if ($vars['view'] == $option) { echo ""; } echo generate_link($text, $link_array, array( 'view' => $option )); if ($vars['view'] == $option) { echo ''; } echo ' | '; } echo ' Graphs: '; $graph_types = array( 'bits' => 'Bits', 'pkts' => 'Packets' ); foreach ($graph_types as $type => $descr) { echo "$type_sep"; if ($vars['graph'] == $type) { echo ""; } echo generate_link($descr, $link_array, array( 'view' => 'graphs', 'graph' => $type )); if ($vars['graph'] == $type) { echo ''; } $type_sep = ' | '; } print_optionbar_end(); $tunnel = dbFetchRows('SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ? ORDER BY `peer_addr`', array( $device['device_id'] )); if (is_null($vars['graph'])) { $tunnel_label = 'warning'; echo ''; foreach ($tunnel as $entry) { $local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr'])); $remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr'])); if ($tunnel['tunnel_status'] = 'active') { $tunnel_label = 'success'; } echo ''; } echo '
Local Identity Remote Identity Name Status
' . $local_addr . ' ' . $remote_addr . ' ' . htmlentities($entry['tunnel_name']) . ' ' . htmlentities($entry['tunnel_status']) . '
'; } else { foreach ($tunnel as $entry) { $local_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['local_addr'])); $remote_addr = preg_replace('/\b0+(?=\d)/', '', htmlentities($entry['peer_addr'])); $graph_type = 'ipsectunnel_' . $vars['graph']; $graph_array['height'] = '100'; $graph_array['width'] = '215'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $entry['tunnel_id']; $graph_array['type'] = $graph_type; echo '

' . $local_addr . ' » ' . $remote_addr . '

'; echo "
"; include 'includes/print-graphrow.inc.php'; echo '
'; echo '
'; echo '
'; } }