From 9c2968266996b21bb4e3754ae7ae4d6100970563 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 6 Oct 2014 12:31:59 +0200 Subject: Fixes #3909 Properly report and detect carp_status --- usr/local/www/carp_status.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'usr') 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 ""; - } else { + if($status > 0) { $carp_enabled = true; echo ""; + } else { + $carp_enabled = false; + echo ""; } if(isset($config["virtualip_carp_maintenancemode"])) { echo ""; -- cgit v1.1