aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinc
diff options
context:
space:
mode:
authorapnar <jlukens@botch.com>2012-09-05 01:41:38 +0000
committerapnar <jlukens@botch.com>2012-09-05 01:41:38 +0000
commit28b367b2a8803c07a89937b5c54dc5cf24cac2f1 (patch)
tree3a2d9f9be673483515baacb7c61c94d475366902 /config/tinc
parent3e9357fb33891ef939594561153abba49f161043 (diff)
downloadpfsense-packages-28b367b2a8803c07a89937b5c54dc5cf24cac2f1.tar.gz
pfsense-packages-28b367b2a8803c07a89937b5c54dc5cf24cac2f1.tar.bz2
pfsense-packages-28b367b2a8803c07a89937b5c54dc5cf24cac2f1.zip
update status page and move status functions into that page
Diffstat (limited to 'config/tinc')
-rw-r--r--config/tinc/status_tinc.php56
-rw-r--r--config/tinc/tinc.inc24
2 files changed, 51 insertions, 29 deletions
diff --git a/config/tinc/status_tinc.php b/config/tinc/status_tinc.php
index 17b8e48c..725ccce6 100644
--- a/config/tinc/status_tinc.php
+++ b/config/tinc/status_tinc.php
@@ -2,23 +2,69 @@
$pgtitle = array(gettext("Status"), "tinc");
require("guiconfig.inc");
-require_once("tinc.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;
+}
+
+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;
+}
+
+$shortcut_section = "tinc";
include("head.inc"); ?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?=$jsevents["body"]["onload"];?>">
<?php include("fbegin.inc"); ?>
-
-1:<BR>
+Connection list:<BR>
<pre>
<?php print tinc_status_1(); ?>
</pre>
<BR>
-2:<BR>
+Virtual network device statistics, all known nodes, edges and subnets:<BR>
<pre>
<?php print tinc_status_2(); ?>
</pre>
-
<?php include("fend.inc"); ?>
diff --git a/config/tinc/tinc.inc b/config/tinc/tinc.inc
index 33e550dd..674223be 100644
--- a/config/tinc/tinc.inc
+++ b/config/tinc/tinc.inc
@@ -103,30 +103,6 @@ function tinc_save() {
config_unlock();
}
-function tinc_status_1() {
- list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb,$atime,$mtimeb,$ctime,$blksize,$blocks)=stat("/var/log/tinc.log");
- exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR1");
- exec("tail -c +" . $sizeb . " /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result);
- $output="";
- foreach($result as $line)
- {
- $output .= $line . "\n";
- }
- return $output;
-}
-
-function tinc_status_2() {
- list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb,$atime,$mtimeb,$ctime,$blksize,$blocks)=stat("/var/log/tinc.log");
- exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2");
- exec("tail -c +" . $sizeb . " /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result);
- $output="";
- foreach($result as $line)
- {
- $output .= $line . "\n";
- }
- return $output;
-}
-
function tinc_install() {
safe_mkdir("/usr/local/etc/tinc");
safe_mkdir("/usr/local/etc/tinc/hosts");