diff --git a/security/pfSense-pkg-tinc/Makefile b/security/pfSense-pkg-tinc/Makefile index 12c640ce2070..1702d7d5f112 100644 --- a/security/pfSense-pkg-tinc/Makefile +++ b/security/pfSense-pkg-tinc/Makefile @@ -2,7 +2,7 @@ PORTNAME= pfSense-pkg-tinc PORTVERSION= 1.0.35 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= security MASTER_SITES= # empty DISTFILES= # empty diff --git a/security/pfSense-pkg-tinc/files/usr/local/www/status_tinc.php b/security/pfSense-pkg-tinc/files/usr/local/www/status_tinc.php index 555e4a0f10cd..7522235cc506 100644 --- a/security/pfSense-pkg-tinc/files/usr/local/www/status_tinc.php +++ b/security/pfSense-pkg-tinc/files/usr/local/www/status_tinc.php @@ -21,26 +21,36 @@ require("guiconfig.inc"); -function tinc_status_usr1() { - exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR1"); +function tinc_status_usr($usr) { + global $g; + exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -k{$usr}"); usleep(500000); - $clog_path = "/usr/local/sbin/clog"; $result = array(); - - exec("{$clog_path} /var/log/tinc.log | /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); + $logfile = "/var/log/tinc.log"; + $clog_path = "/usr/local/sbin/clog"; + + if (pfs_version_compare(false, 2.4, $g['product_version'])) { + exec(system_log_get_cat() . ' ' . sort_related_log_files($logfile, true, true) . "| /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); + } else { + exec("{$clog_path} {$logfile} | /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); + } + $i = 0; + $matchbegin = ($usr == 'USR1') ? "Connections:" : "Statistics for Generic BSD (tun|tap) device"; + $matchend = ($usr == 'USR1') ? "End of connections." : "End of subnet list."; foreach ($result as $line) { - if (preg_match("/Connections:/", $line)) { + if (preg_match("/{$matchbegin}/", $line)) { $begin = $i; } - if (preg_match("/End of connections./", $line)) { + if (preg_match("/{$matchend}/", $line)) { $end = $i; } $i++; } + $output = ""; $i = 0; - + foreach ($result as $line) { if ($i >= $begin && $i<= $end) { $output .= "" . $line . ""; @@ -48,37 +58,7 @@ function tinc_status_usr1() { $i++; } return $output; - -} - -function tinc_status_usr2() { - exec("/usr/local/sbin/tincd --config=/usr/local/etc/tinc -kUSR2"); - usleep(500000); - $clog_path = "/usr/local/sbin/clog"; - $result = array(); - - 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|tap) 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 . ""; - } - $i++; - } - return $output; - + } $shortcut_section = "tinc"; @@ -91,7 +71,7 @@ function tinc_status_usr2() {
- +
@@ -102,7 +82,7 @@ function tinc_status_usr2() {
- +