From 1af5edbf04e0e3bbbc55981f6fc404b60ff33f2b Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Fri, 11 Dec 2015 16:44:11 -0500 Subject: Rename of files to better match their position in the memory structure --- src/usr/local/www/status_carp.php | 275 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 src/usr/local/www/status_carp.php (limited to 'src/usr/local/www/status_carp.php') diff --git a/src/usr/local/www/status_carp.php b/src/usr/local/www/status_carp.php new file mode 100644 index 0000000..b6a3d93 --- /dev/null +++ b/src/usr/local/www/status_carp.php @@ -0,0 +1,275 @@ + 0) { + set_single_sysctl('net.inet.carp.allow', '0'); + if (is_array($config['virtualip']['vip'])) { + $viparr = &$config['virtualip']['vip']; + foreach ($viparr as $vip) { + switch ($vip['mode']) { + case "carp": + interface_vip_bring_down($vip); + + /* + * Reconfigure radvd when necessary + * XXX: Is it the best way to do it? + */ + if (isset($config['dhcpdv6']) && is_array($config['dhcpdv6'])) { + foreach ($config['dhcpdv6'] as $dhcpv6if => $dhcpv6ifconf) { + if ($dhcpv6if !== $vip['interface'] || + $dhcpv6ifconf['ramode'] === "disabled") { + continue; + } + + services_radvd_configure(); + break; + } + } + + sleep(1); + break; + } + } + } + $savemsg = sprintf(gettext("%s IPs have been disabled. Please note that disabling does not survive a reboot and some configuration changes will re-enable."), $carp_counter); + $status = 0; + } else { + $savemsg = gettext("CARP has been enabled."); + if (is_array($config['virtualip']['vip'])) { + $viparr = &$config['virtualip']['vip']; + foreach ($viparr as $vip) { + switch ($vip['mode']) { + case "carp": + interface_carp_configure($vip); + sleep(1); + break; + case 'ipalias': + if (strpos($vip['interface'], '_vip')) { + interface_ipalias_configure($vip); + } + break; + } + } + } + interfaces_sync_setup(); + set_single_sysctl('net.inet.carp.allow', '1'); + $status = 1; + } +} + +$carp_detected_problems = get_single_sysctl("net.inet.carp.demotion"); + +if (!empty($_POST['resetdemotion'])) { + set_single_sysctl("net.inet.carp.demotion", "-{$carp_detected_problems}"); + sleep(1); + $carp_detected_problems = get_single_sysctl("net.inet.carp.demotion"); +} + +$pgtitle = array(gettext("Status"), gettext("CARP")); +$shortcut_section = "carp"; + +include("head.inc"); +if ($savemsg) + print_info_box($savemsg, 'success'); + +$carpcount = 0; +if (is_array($config['virtualip']['vip'])) { + foreach ($config['virtualip']['vip'] as $carp) { + if ($carp['mode'] == "carp") { + $carpcount++; + break; + } + } +} + + +// If $carpcount > 0 display buttons then display table +// otherwise display error box and quit + +?> + +' . + '' . + gettext("You can configure high availability sync settings here") . + ''); +} else +{ +?> +
+ 0) + $carp_enabled = true; + else + $carp_enabled = false; + + // Sadly this needs to be here so that it is inside the form + if ($carp_detected_problems > 0) { + print_info_box( + gettext("CARP has detected a problem and this unit has been demoted to BACKUP status.") . "
" . + gettext("Check the link status on all interfaces with configured CARP VIPs.") . "
" . + gettext("Search the") . + " " . + gettext("system log") . + " " . + gettext("for CARP demotion-related events.") . "

" . + '', 'danger' + ); + } + +?> + " /> + " /> + +

+ +
+

+
+ + + + + + + + + + + + + + + + + +
@ 
+
+
+
+ +
+

+
+
    +'. $node .''; + } +?> +
+
+
+ +