Révision 9c296826
Ajouté par Ermal il y a plus de 9 ans
usr/local/www/carp_status.php | ||
---|---|---|
50 | 50 |
unset($interface_ip_arr_cache); |
51 | 51 |
|
52 | 52 |
$status = get_carp_status(); |
53 |
$status = intval($status); |
|
53 | 54 |
if($_POST['carp_maintenancemode'] <> "") { |
54 | 55 |
interfaces_carp_set_maintenancemode(!isset($config["virtualip_carp_maintenancemode"])); |
55 | 56 |
} |
56 | 57 |
if($_POST['disablecarp'] <> "") { |
57 |
if($status == true) {
|
|
58 |
if($status > 0) {
|
|
58 | 59 |
set_single_sysctl('net.inet.carp.allow', '0'); |
59 | 60 |
if(is_array($config['virtualip']['vip'])) { |
60 | 61 |
$viparr = &$config['virtualip']['vip']; |
... | ... | |
68 | 69 |
} |
69 | 70 |
} |
70 | 71 |
$savemsg = sprintf(gettext("%s IPs have been disabled. Please note that disabling does not survive a reboot."), $carp_counter); |
72 |
$status = 0; |
|
71 | 73 |
} else { |
72 | 74 |
$savemsg = gettext("CARP has been enabled."); |
73 | 75 |
if(is_array($config['virtualip']['vip'])) { |
... | ... | |
83 | 85 |
} |
84 | 86 |
interfaces_carp_setup(); |
85 | 87 |
set_single_sysctl('net.inet.carp.allow', '1'); |
88 |
$status = 1; |
|
86 | 89 |
} |
87 | 90 |
} |
88 | 91 |
|
89 |
$status = get_carp_status(); |
|
90 |
|
|
91 |
$carp_detected_problems = (array_pop(get_sysctl("net.inet.carp.demotion")) > 0); |
|
92 |
$carp_detected_problems = ((get_single_sysctl("net.inet.carp.demotion")) > 0); |
|
92 | 93 |
|
93 | 94 |
$pgtitle = array(gettext("Status"),gettext("CARP")); |
94 | 95 |
$shortcut_section = "carp"; |
... | ... | |
119 | 120 |
} |
120 | 121 |
} |
121 | 122 |
if($carpcount > 0) { |
122 |
if($status == false) { |
|
123 |
$carp_enabled = false; |
|
124 |
echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />"; |
|
125 |
} else { |
|
123 |
if($status > 0) { |
|
126 | 124 |
$carp_enabled = true; |
127 | 125 |
echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Temporarily Disable CARP") . "\" />"; |
126 |
} else { |
|
127 |
$carp_enabled = false; |
|
128 |
echo "<input type=\"submit\" name=\"disablecarp\" id=\"disablecarp\" value=\"" . gettext("Enable CARP") . "\" />"; |
|
128 | 129 |
} |
129 | 130 |
if(isset($config["virtualip_carp_maintenancemode"])) { |
130 | 131 |
echo "<input type=\"submit\" name=\"carp_maintenancemode\" id=\"carp_maintenancemode\" value=\"" . gettext("Leave Persistent CARP Maintenance Mode") . "\" />"; |
Formats disponibles : Unified diff
Fixes #3909 Properly report and detect carp_status