-
Notifications
You must be signed in to change notification settings - Fork 581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch clog to cat in status_tinc.php #691
Changes from 6 commits
bdcc21d
ddbf04d
f8b7683
41058bf
830b469
7100f41
ec22646
b611032
cbe226a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,15 @@ function tinc_status_usr1() { | |
usleep(500000); | ||
$clog_path = "/usr/local/sbin/clog"; | ||
$result = array(); | ||
$logfile = "/var/log/tinc.log"; | ||
$firmware = host_firmware_version(); | ||
|
||
exec("{$clog_path} /var/log/tinc.log | /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); | ||
if ($firmware['config_version'] >= 19.7) { | ||
exec(system_log_get_cat() . ' ' . $logfile . "| /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than |
||
} else { | ||
exec("{$clog_path} /var/log/tinc.log | /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why use the full hardcoded path to the log here, rather than |
||
} | ||
|
||
$i = 0; | ||
foreach ($result as $line) { | ||
jim-p marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (preg_match("/Connections:/", $line)) { | ||
|
@@ -56,8 +63,15 @@ function tinc_status_usr2() { | |
usleep(500000); | ||
$clog_path = "/usr/local/sbin/clog"; | ||
$result = array(); | ||
$logfile = "/var/log/tinc.log"; | ||
$firmware = host_firmware_version(); | ||
|
||
exec("{$clog_path} /var/log/tinc.log | sed -e 's/.*tinc\[.*\]: //'",$result); | ||
if ($firmware['config_version'] >= 19.7) { | ||
exec(system_log_get_cat() . ' ' . $logfile . "| /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); | ||
} else { | ||
exec("{$clog_path} /var/log/tinc.log | /usr/bin/sed -e 's/.*tinc\[.*\]: //'", $result); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comments above which also apply to this similar block. |
||
$i = 0; | ||
foreach ($result as $line) { | ||
if (preg_match("/Statistics for Generic BSD (tun|tap) device/",$line)) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a proper version test. The config revision is not a reliable indicator of the pfSense version. It should be based on
$g['product_version']
or similar to test the actual version directly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case of $g['product_version'] we need to enumerate all supported versions
better to use kernel version number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not. That does not necessarily determine the pfSense version either. It must use product_version. If you need to compare, there are convenience functions like
pfs_version_compare()
that facilitate a proper comparison.