summaryrefslogtreecommitdiffstats
path: root/usr/local/www/carp_status.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2014-10-06 12:31:59 +0200
committerErmal <eri@pfsense.org>2014-10-06 12:31:59 +0200
commit9c2968266996b21bb4e3754ae7ae4d6100970563 (patch)
treeff240f2ee6b7f9505ce290854ca143c06b867e4a /usr/local/www/carp_status.php
parent2d5fd3c23c570e054a0bbe3fadcbae9b008d9133 (diff)
downloadpfsense-9c2968266996b21bb4e3754ae7ae4d6100970563.zip
pfsense-9c2968266996b21bb4e3754ae7ae4d6100970563.tar.gz
Fixes #3909 Properly report and detect carp_status
Diffstat (limited to 'usr/local/www/carp_status.php')
-rw-r--r--usr/local/www/carp_status.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php
index 192875e..d53cf50 100644
--- a/usr/local/www/carp_status.php
+++ b/usr/local/www/carp_status.php
@@ -50,11 +50,12 @@ unset($carp_interface_count_cache);
unset($interface_ip_arr_cache);
$status = get_carp_status();
+$status = intval($status);
if($_POST['carp_maintenancemode'] <> "") {
interfaces_carp_set_maintenancemode(!isset($config["virtualip_carp_maintenancemode"]));
}
if($_POST['disablecarp'] <> "") {
- if($status == true) {
+ if($status > 0) {
set_single_sysctl('net.inet.carp.allow', '0');
if(is_array($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
@@ -68,6 +69,7 @@ if($_POST['disablecarp'] <> "") {
}
}
$savemsg = sprintf(gettext("%s IPs have been disabled. Please note that disabling does not survive a reboot."), $carp_counter);
+ $status = 0;
} else {
$savemsg = gettext("CARP has been enabled.");
if(is_array($config['virtualip']['vip'])) {
@@ -83,12 +85,11 @@ if($_POST['disablecarp'] <> "") {
}
interfaces_carp_setup();
set_single_sysctl('net.inet.carp.allow', '1');
+ $status = 1;
}
}
-$status = get_carp_status();
-
-$carp_detected_problems = (array_pop(get_sysctl("net.inet.carp.demotion")) > 0);
+$carp_detected_problems = ((get_single_sysctl("net.inet.carp.demotion")) > 0);
$pgtitle = array(gettext("Status"),gettext("CARP"));
$shortcut_section = "carp";
@@ -119,12 +120,12 @@ include("head.inc");
}
}
if($carpcount > 0) {
- if($status == false) {
- $carp_enabled = false;
- echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />";
- } else {
+ if($status > 0) {
$carp_enabled = true;
echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Temporarily Disable CARP") . "\" />";
+ } else {
+ $carp_enabled = false;
+ echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />";
}
if(isset($config["virtualip_carp_maintenancemode"])) {
echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Leave Persistent CARP Maintenance Mode") . "\" />";
OpenPOWER on IntegriCloud