diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-05-14 14:03:37 -0400 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-05-14 14:03:37 -0400 |
commit | 1a20fc6d045ab53152605bbc34f1df2f64815e78 (patch) | |
tree | 171926bda496a6ac3221ce92c802d2e370f25c52 /config | |
parent | dd0108dd6d0638610e0e601255c75c9f57f813e4 (diff) | |
parent | 81714335cddd6a59c21cd1b48fb1c07286722d9c (diff) | |
download | pfsense-packages-1a20fc6d045ab53152605bbc34f1df2f64815e78.tar.gz pfsense-packages-1a20fc6d045ab53152605bbc34f1df2f64815e78.tar.bz2 pfsense-packages-1a20fc6d045ab53152605bbc34f1df2f64815e78.zip |
Merge pull request #658 from PiBa-NL/tinc_status
Diffstat (limited to 'config')
-rw-r--r-- | config/tinc/status_tinc.php | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php index cd7b0aad..f50ea640 100644 --- a/config/tinc/status_tinc.php +++ b/config/tinc/status_tinc.php @@ -12,27 +12,28 @@ function tinc_status_1() { $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; + $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() { @@ -44,27 +45,28 @@ function tinc_status_2() { $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; + $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"; |