summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2018-11-20 17:27:28 -0200
committerRenato Botelho <renato@netgate.com>2018-11-20 17:30:14 -0200
commit31e18c7b0411184925c9e32396be463f891569f9 (patch)
tree890b5b1708a4f2bc727c67a2643c241331125114 /src
parent4a374a0d24d22a91bb86001ffc0e7c99ef815533 (diff)
downloadpfsense-31e18c7b0411184925c9e32396be463f891569f9.zip
pfsense-31e18c7b0411184925c9e32396be463f891569f9.tar.gz
Fix #8465: Preserve default gw when switch to BACKUP
interfaces_carp_set_maintenancemode() calls interface_carp_configure() to each configured CARP and it ends up reconfiguring completely the interface when it's not necessary. Add a new parameter $maintenancemode_only to interface_carp_configure() and use it to only change advskew to 254 when going to forced maintenance mode and move it back to configured value when leaving
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/interfaces.inc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 55c41b6..4ccd245 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -1814,7 +1814,7 @@ function interfaces_carp_set_maintenancemode($carp_maintenancemode) {
if (is_array($viparr)) {
foreach ($viparr as $vip) {
if ($vip['mode'] == "carp") {
- interface_carp_configure($vip);
+ interface_carp_configure($vip, true);
}
}
}
@@ -2821,7 +2821,7 @@ function interface_ipalias_configure(&$vip) {
unset($iface, $af, $realif, $carpvip, $vhid);
}
-function interface_carp_configure(&$vip) {
+function interface_carp_configure(&$vip, $maintenancemode_only = false) {
global $config, $g;
if (isset($config['system']['developerspew'])) {
$mt = microtime();
@@ -2869,16 +2869,18 @@ function interface_carp_configure(&$vip) {
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']));
- } else if (is_ipaddrv6($vip['subnet'])) {
- mwexec("/sbin/ifconfig {$realif} inet6 " .
- escapeshellarg($vip['subnet']) . " prefixlen " .
- escapeshellarg($vip['subnet_bits']) . " alias vhid " .
- escapeshellarg($vip['vhid']));
+ if (!$maintenancemode_only) {
+ if (is_ipaddrv4($vip['subnet'])) {
+ mwexec("/sbin/ifconfig {$realif} " .
+ escapeshellarg($vip['subnet']) . "/" .
+ escapeshellarg($vip['subnet_bits']) .
+ " alias vhid " . escapeshellarg($vip['vhid']));
+ } else if (is_ipaddrv6($vip['subnet'])) {
+ mwexec("/sbin/ifconfig {$realif} inet6 " .
+ escapeshellarg($vip['subnet']) . " prefixlen " .
+ escapeshellarg($vip['subnet_bits']) .
+ " alias vhid " . escapeshellarg($vip['vhid']));
+ }
}
return $realif;
OpenPOWER on IntegriCloud