From a4736cbf3233e00d4ead05792c2ce0358d4bb8f2 Mon Sep 17 00:00:00 2001
From: Franco Fichtner
=gettext("Note"); ?>:
" . gettext("Unfortunately we have detected at least one programming bug.") . " " . gettext("Would you like to submit this crash report to the developers?") . " " . gettext("You can help us further by optionally adding your contact information and a problem description.") . " " . gettext("Please double-check the following contents to ensure you are comfortable submitting the following information.") . " {$report}:
" . gettext("Could not locate any defined CARP interfaces.");
+ if ($carpcount == 0) {
+ echo "
" . gettext("Could not locate any defined CARP interfaces.");
- }
- elseif(is_array($config['virtualip']['vip'])) {
- foreach($config['virtualip']['vip'] as $carp) {
- if ($carp['mode'] != "carp")
- continue;
- $ipaddress = $carp['subnet'];
- $password = $carp['password'];
- $netmask = $carp['subnet_bits'];
- $vhid = $carp['vhid'];
- $advskew = $carp['advskew'];
- $advbase = $carp['advbase'];
- $status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
- echo "";
- $align = "style=\"vertical-align:middle\"";
- if($carp_enabled == false) {
- $icon = "";
- $status = "DISABLED";
- } else {
- if($status == "MASTER") {
- $icon = "";
- } else if($status == "BACKUP") {
- $icon = "";
- } else if($status == "INIT") {
- $icon = "";
- }
- }
- echo " ";
- }
- }
- ?>
+ } elseif (is_array($config['virtualip']['vip'])) {
+ foreach ($config['virtualip']['vip'] as $carp) {
+ if ($carp['mode'] != "carp") {
+ continue;
+ }
+ $ipaddress = $carp['subnet'];
+ $password = $carp['password'];
+ $netmask = $carp['subnet_bits'];
+ $vhid = $carp['vhid'];
+ $advskew = $carp['advskew'];
+ $advbase = $carp['advbase'];
+ $status = get_carp_interface_status("{$carp['interface']}_vip{$carp['vhid']}");
+ echo "" . convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid} ";
- echo "" . $ipaddress . " ";
- echo "{$icon} " . $status . " ";
- echo "";
+ $align = "style=\"vertical-align:middle\"";
+ if ($carp_enabled == false) {
+ $icon = "";
+ $status = "DISABLED";
+ } else {
+ if ($status == "MASTER") {
+ $icon = "";
+ } elseif ($status == "BACKUP") {
+ $icon = "";
+ } elseif ($status == "INIT") {
+ $icon = "";
+ }
+ }
+ echo " ";
+ }
+ }
+ ?>
" . convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid} ";
+ echo "" . $ipaddress . " ";
+ echo "{$icon} " . $status . " ";
+ echo "
- =gettext("You can configure high availability settings"); ?> =gettext("here"); ?>.
+ =gettext("You can configure high availability settings");
+?> =gettext("here"); ?>.
";
- echo "";
- system("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u");
- echo "";
- ?>
+ echo "
" . gettext("pfSync nodes") . ":
";
+ echo "";
+ system("/sbin/pfctl -vvss | /usr/bin/grep creator | /usr/bin/cut -d\" \" -f7 | /usr/bin/sort -u");
+ echo "";
+ ?>
diff --git a/src/www/crash_reporter.php b/src/www/crash_reporter.php
index 649839a4c..76e5467bc 100644
--- a/src/www/crash_reporter.php
+++ b/src/www/crash_reporter.php
@@ -33,33 +33,33 @@ require_once("captiveportal.inc");
function upload_crash_report($files, $agent)
{
- global $g;
+ global $g;
- $post = array();
- $counter = 0;
+ $post = array();
+ $counter = 0;
- foreach($files as $filename) {
- if (is_link($filename) || $filename == '/var/crash/minfree.gz' || $filename == '/var/crash/bounds.gz') {
- continue;
- }
- $post["file{$counter}"] = curl_file_create($filename, "application/x-gzip", basename($filename));
- $counter++;
- }
+ foreach ($files as $filename) {
+ if (is_link($filename) || $filename == '/var/crash/minfree.gz' || $filename == '/var/crash/bounds.gz') {
+ continue;
+ }
+ $post["file{$counter}"] = curl_file_create($filename, "application/x-gzip", basename($filename));
+ $counter++;
+ }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://crash.opnsense.org/');
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_VERBOSE, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, $agent);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data;' ) );
- $response = curl_exec($ch);
- curl_close($ch);
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, 'https://crash.opnsense.org/');
+ curl_setopt($ch, CURLOPT_HEADER, false);
+ curl_setopt($ch, CURLOPT_VERBOSE, false);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_USERAGENT, $agent);
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data;' ));
+ $response = curl_exec($ch);
+ curl_close($ch);
- return !$response;
+ return !$response;
}
$pgtitle = array(gettext('System'), gettext('Crash Reporter'));
@@ -67,14 +67,14 @@ include('head.inc');
$last_version = '/usr/local/opnsense/version/opnsense.last';
$crash_report_header = sprintf(
- "%s\n%s %s%s %s (%s)\nUUID %s\n",
- php_uname('v'),
- $g['product_name'],
- trim(file_get_contents('/usr/local/opnsense/version/opnsense')),
- file_exists($last_version) ? sprintf(' [%s]', trim(file_get_contents($last_version))) : '',
- trim(shell_exec('/usr/local/bin/openssl version')),
- php_uname('m'),
- shell_exec('/sbin/sysctl -b kern.hostuuid')
+ "%s\n%s %s%s %s (%s)\nUUID %s\n",
+ php_uname('v'),
+ $g['product_name'],
+ trim(file_get_contents('/usr/local/opnsense/version/opnsense')),
+ file_exists($last_version) ? sprintf(' [%s]', trim(file_get_contents($last_version))) : '',
+ trim(shell_exec('/usr/local/bin/openssl version')),
+ php_uname('m'),
+ shell_exec('/sbin/sysctl -b kern.hostuuid')
);
$pkgver = explode('-', trim(file_get_contents('/usr/local/opnsense/version/opnsense')));
@@ -83,53 +83,53 @@ $crash_reports = array();
$has_crashed = false;
if (isset($_POST['Submit'])) {
- if ($_POST['Submit'] == 'yes') {
- if (!is_dir('/var/crash')) {
- mkdir('/var/crash', 0750, true);
- }
- $email = trim($_POST['Email']);
- if (!empty($email)) {
- $crash_report_header .= "Email {$email}\n";
- }
- $desc = trim($_POST['Desc']);
- if (!empty($desc)) {
- $crash_report_header .= "Description\n\n{$desc}";
- }
- file_put_contents('/var/crash/crashreport_header.txt', $crash_report_header);
- @rename('/tmp/PHP_errors.log', '/var/crash/PHP_errors.log');
- @copy('/var/run/dmesg.boot', '/var/crash/dmesg.boot');
- exec('/usr/bin/gzip /var/crash/*');
- $files_to_upload = glob('/var/crash/*');
- $resp = upload_crash_report($files_to_upload, $user_agent);
- array_map('unlink', $files_to_upload);
- } elseif ($_POST['Submit'] == 'no') {
- array_map('unlink', glob('/var/crash/*'));
- @unlink('/tmp/PHP_errors.log');
- } elseif ($_POST['Submit'] == 'new') {
- /* force a crash report generation */
- $has_crashed = true;
- }
+ if ($_POST['Submit'] == 'yes') {
+ if (!is_dir('/var/crash')) {
+ mkdir('/var/crash', 0750, true);
+ }
+ $email = trim($_POST['Email']);
+ if (!empty($email)) {
+ $crash_report_header .= "Email {$email}\n";
+ }
+ $desc = trim($_POST['Desc']);
+ if (!empty($desc)) {
+ $crash_report_header .= "Description\n\n{$desc}";
+ }
+ file_put_contents('/var/crash/crashreport_header.txt', $crash_report_header);
+ @rename('/tmp/PHP_errors.log', '/var/crash/PHP_errors.log');
+ @copy('/var/run/dmesg.boot', '/var/crash/dmesg.boot');
+ exec('/usr/bin/gzip /var/crash/*');
+ $files_to_upload = glob('/var/crash/*');
+ $resp = upload_crash_report($files_to_upload, $user_agent);
+ array_map('unlink', $files_to_upload);
+ } elseif ($_POST['Submit'] == 'no') {
+ array_map('unlink', glob('/var/crash/*'));
+ @unlink('/tmp/PHP_errors.log');
+ } elseif ($_POST['Submit'] == 'new') {
+ /* force a crash report generation */
+ $has_crashed = true;
+ }
} else {
- /* if there is no user activity probe for a crash report */
- $has_crashed = get_crash_report(true) != '';
+ /* if there is no user activity probe for a crash report */
+ $has_crashed = get_crash_report(true) != '';
}
if ($has_crashed) {
- $crash_files = glob("/var/crash/*");
- $crash_reports['System Information'] = trim($crash_report_header);
- $php_errors = @file_get_contents('/tmp/PHP_errors.log');
- if (!empty($php_errors)) {
- $crash_reports['PHP Errors'] = trim($php_errors);
- }
- $dmesg_boot = @file_get_contents('/var/run/dmesg.boot');
- if (!empty($dmesg_boot)) {
- $crash_reports['dmesg.boot'] = trim($dmesg_boot);
- }
- foreach ($crash_files as $cf) {
- if (!is_link($cf) && $cf != '/var/crash/minfree' && $cf != '/var/crash/bounds' && filesize($cf) < 450000) {
- $crash_reports[$cf] = trim(file_get_contents($cf));
- }
- }
+ $crash_files = glob("/var/crash/*");
+ $crash_reports['System Information'] = trim($crash_report_header);
+ $php_errors = @file_get_contents('/tmp/PHP_errors.log');
+ if (!empty($php_errors)) {
+ $crash_reports['PHP Errors'] = trim($php_errors);
+ }
+ $dmesg_boot = @file_get_contents('/var/run/dmesg.boot');
+ if (!empty($dmesg_boot)) {
+ $crash_reports['dmesg.boot'] = trim($dmesg_boot);
+ }
+ foreach ($crash_files as $cf) {
+ if (!is_link($cf) && $cf != '/var/crash/minfree' && $cf != '/var/crash/bounds' && filesize($cf) < 450000) {
+ $crash_reports[$cf] = trim(file_get_contents($cf));
+ }
+ }
}
?>
@@ -149,29 +149,29 @@ if ($has_crashed) {
";
- echo "";
- echo "{$content}
" . gettext("Unfortunately we have detected at least one programming bug.") . "
"; + echo "" . gettext("Would you like to submit this crash report to the developers?") . "
"; + echo "" . gettext("You can help us further by optionally adding your contact information and a problem description.") . "
"; + echo ""; + echo ""; + echo "" . gettext("Please double-check the following contents to ensure you are comfortable submitting the following information.") . "
"; + foreach ($crash_reports as $report => $content) { + echo "{$report}:
{$content}";
+ }
} else {
- $message = gettext('Luckily we have not detected a programming bug.');
- if (isset($_POST['Submit'])) {
- if ($_POST['Submit'] == 'yes') {
- $message = gettext('Thank you for submitting this crash report.');
- } elseif ($_POST['Submit'] == 'no') {
- $message = gettext('Please consider submitting a crash report if the error persists.');
- }
- }
+ $message = gettext('Luckily we have not detected a programming bug.');
+ if (isset($_POST['Submit'])) {
+ if ($_POST['Submit'] == 'yes') {
+ $message = gettext('Thank you for submitting this crash report.');
+ } elseif ($_POST['Submit'] == 'no') {
+ $message = gettext('Please consider submitting a crash report if the error persists.');
+ }
+ }
- echo '' . $message . '
' . $message . '