From 08efcbb61112e9e5743f13790fc9ca81856db846 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Wed, 26 Aug 2015 17:02:37 +0200 Subject: tinc - pfSense 2.2.x fixes, code style and improvements - Add copyright header - XHTML valid code - Fix code style, whitespace and indentation - Removed the useless checks for clog location on pfSense <2.1.2 --- config/tinc/status_tinc.php | 119 +++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 50 deletions(-) (limited to 'config/tinc/status_tinc.php') diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index f50ea640..59a1cb6e 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -1,88 +1,107 @@ = $begin && $i<= $end) + $output = ""; + $i = 0; + foreach ($result as $line) { + if ($i >= $begin && $i<= $end) { $output .= $line . "\n"; + } $i++; } return $output; } -function tinc_status_2() { - exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2"); +function tinc_status_usr2() { + exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2"); usleep(500000); - $clog_path = ""; + $clog_path = "/usr/local/sbin/clog"; $result = array(); - if (is_executable("/usr/local/sbin/clog")) { - $clog_path = "/usr/local/sbin/clog"; - } elseif (is_executable("/usr/sbin/clog")) { - $clog_path = "/usr/sbin/clog"; - } - if (!empty($clog_path)) - exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); - $i=0; - foreach($result as $line) - { - if(preg_match("/Statistics for Generic BSD tun device/",$line)) - $begin=$i; - if(preg_match("/End of subnet list./",$line)) - $end=$i; + exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); + $i = 0; + foreach ($result as $line) { + if (preg_match("/Statistics for Generic BSD tun device/",$line)) { + $begin = $i; + } + if (preg_match("/End of subnet list./",$line)) { + $end = $i; + } $i++; } $output=""; - $i=0; - foreach($result as $line) - { - if($i >= $begin && $i<= $end) + $i = 0; + foreach ($result as $line) { + if ($i >= $begin && $i<= $end) { $output .= $line . "\n"; + } $i++; } return $output; } $shortcut_section = "tinc"; -include("head.inc"); ?> +$pgtitle = array(gettext("Status"), "tinc"); +include("head.inc"); +?> "> -Connection list:
+Connection list:
-
+
 
-
-Virtual network device statistics, all known nodes, edges and subnets:
+
+Virtual network device statistics, all known nodes, edges and subnets:
-
+
 
+ + -- cgit v1.2.3