summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2014-03-21 16:16:43 +0100
committerPiBa-NL <pba_2k3@yahoo.com>2014-03-30 00:09:30 +0100
commit783f1ee2107bc8746542c9c412596b8830488000 (patch)
tree0d8a93d4cd4f599af7594a07271dcacaaea9ba28 /etc
parenta6bb4e06551224137312b60dfc7db5c06581d35f (diff)
downloadpfsense-783f1ee2107bc8746542c9c412596b8830488000.zip
pfsense-783f1ee2107bc8746542c9c412596b8830488000.tar.gz
carp, provide a way to 'permanently' set carp to 'maintenance mode' (advskew 254) persisting a reboot
Option to set CARP interfaces to 'maintenance mode', persisting through a reboot so the primary machines stays as backup/inactive. This is required when there are some problems (possibly with the hardware) and the primary machine needs to be booted and checked again before becoming 'master'. Currently it will take back the master state during reboot even though there might still be problems or some re-configuring to do. p.s. it is for some reason not possible to reset advskew back to '0'.. should that number be removed as an option, and use 1 as a minimal value ?
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/interfaces.inc27
1 files changed, 26 insertions, 1 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 3112767..c60ea4f 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1346,6 +1346,25 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
return;
}
+function interfaces_carp_set_maintenancemode($carp_maintenancemode){
+ global $config;
+ if (isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == false) {
+ unset($config["virtualip_carp_maintenancemode"]);
+ write_config("Leave CARP maintenance mode");
+ } else
+ if (!isset($config["virtualip_carp_maintenancemode"]) && $carp_maintenancemode == true) {
+ $config["virtualip_carp_maintenancemode"] = true;
+ write_config("Enter CARP maintenance mode");
+ }
+
+ $viparr = &$config['virtualip']['vip'];
+ foreach ($viparr as $vip) {
+ if ($vip['mode'] == "carp") {
+ interface_carp_configure($vip);
+ }
+ }
+}
+
function interfaces_ptpid_used($ptpid) {
global $config;
@@ -2174,7 +2193,13 @@ function interface_carp_configure(&$vip) {
if (!empty($vip['advbase']))
$advbase = "advbase " . escapeshellarg($vip['advbase']);
- mwexec("/sbin/ifconfig {$realif} vhid " . escapeshellarg($vip['vhid']) . " advskew " . escapeshellarg($vip['advskew']) . " {$advbase} {$password}");
+ $carp_maintenancemode = isset($config["virtualip_carp_maintenancemode"]);
+ if ($carp_maintenancemode)
+ $advskew = "advskew 254";
+ else
+ $advskew = "advskew " . escapeshellarg($vip['advskew']);
+
+ mwexec("/sbin/ifconfig {$realif} vhid " . escapeshellarg($vip['vhid']) . " {$advskew} {$advbase} {$password}");
if (is_ipaddrv4($vip['subnet']))
mwexec("/sbin/ifconfig {$realif} " . escapeshellarg($vip['subnet']) . "/" . escapeshellarg($vip['subnet_bits']) . " alias vhid " . escapeshellarg($vip['vhid']));
OpenPOWER on IntegriCloud