diff options
Diffstat (limited to 'config/tinc')
-rw-r--r-- | config/tinc/status_tinc.php | 94 | ||||
-rw-r--r-- | config/tinc/tinc.xml | 2 |
2 files changed, 57 insertions, 39 deletions
diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index 725ccce6..f50ea640 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -6,49 +6,67 @@ require("guiconfig.inc"); function tinc_status_1() { exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR1"); usleep(500000); - exec("/usr/sbin/clog /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); - $i=0; - foreach($result as $line) - { - if(preg_match("/Connections:/",$line)) - $begin=$i; - if(preg_match("/End of connections./",$line)) - $end=$i; - $i++; - } - $output=""; - $i=0; - foreach($result as $line) - { - if($i >= $begin && $i<= $end) - $output .= $line . "\n"; - $i++; - } - return $output; + $clog_path = ""; + $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("/Connections:/",$line)) + $begin=$i; + if(preg_match("/End of connections./",$line)) + $end=$i; + $i++; + } + $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"); usleep(500000); - exec("/usr/sbin/clog /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) - $output .= $line . "\n"; - $i++; - } - return $output; + $clog_path = ""; + $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; + $i++; + } + $output=""; + $i=0; + foreach($result as $line) + { + if($i >= $begin && $i<= $end) + $output .= $line . "\n"; + $i++; + } + return $output; } $shortcut_section = "tinc"; diff --git a/config/tinc/tinc.xml b/config/tinc/tinc.xml index f016dd41..183ae161 100644 --- a/config/tinc/tinc.xml +++ b/config/tinc/tinc.xml @@ -42,7 +42,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>tinc</name> - <version>1.0.21 v1.1</version> + <version>1.0.23 v1.2.1</version> <title>VPN: tinc</title> <!-- Menu is where this packages menu will appear --> <menu> |