Exemple #1
0
$status = intval($status);
if ($_POST['carp_maintenancemode'] != "") {
    interfaces_carp_set_maintenancemode(!isset($config["virtualip_carp_maintenancemode"]));
}
if ($_POST['disablecarp'] != "") {
    if ($status > 0) {
        set_single_sysctl('net.inet.carp.allow', '0');
        if (is_array($config['virtualip']['vip'])) {
            $viparr =& $config['virtualip']['vip'];
            $found_dhcpdv6 = false;
            foreach ($viparr as $vip) {
                $carp_iface = "{$vip['interface']}_vip{$vip['vhid']}";
                switch ($vip['mode']) {
                    case "carp":
                        interface_vip_bring_down($vip);
                        interface_ipalias_cleanup($carp_iface);
                        /*
                         * 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 ($dhcpv6ifconf['rainterface'] != $carp_iface) {
                                    continue;
                                }
                                services_radvd_configure();
                                break;
                            }
                        }
                        sleep(1);
                        break;
Exemple #2
0
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 > 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);
                        interface_ipalias_cleanup("{$vip['interface']}_vip{$vip['vhid']}");
                        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);