Skip to content

Commit

Permalink
system: do not use down / forced down for gateway switching
Browse files Browse the repository at this point in the history
(cherry picked from commit 195cec1)
(cherry picked from commit 9747e1f)
  • Loading branch information
fichtner committed Jul 17, 2018
1 parent f2cc199 commit da4d25e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/etc/inc/filter.inc
Expand Up @@ -315,9 +315,7 @@ function filter_configure_sync($verbose = false, $flush_states = false)
}

if (isset($config['system']['gw_switch_default'])) {
$gateways_status = return_gateways_status(true);
$gateways_arr = return_gateways_array();
fixup_default_gateway($gateways_status, $gateways_arr);
fixup_default_gateway();
}

$aliases = filter_generate_aliases();
Expand Down
7 changes: 5 additions & 2 deletions src/etc/inc/gwlb.inc
Expand Up @@ -862,8 +862,11 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
return $gateways_arr;
}

function fixup_default_gateway($gateways_status, $gateways_arr)
function fixup_default_gateway()
{
$gateways_status = return_gateways_status(true);
$gateways_arr = return_gateways_array();

foreach (array("inet", "inet6") as $ipprotocol) {
$dfltgwname = null;
$dfltgwip = null;
Expand All @@ -878,7 +881,7 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
/* wrong address family */
continue;
}
if (!isset($gwsttng['monitoring_disabled']) && $gateways_status[$gwname]['status'] === 'down') {
if (strpos($gateways_status[$gwname]['status'], 'down') !== false) {
/* cannot use down gateway */
continue;
}
Expand Down

0 comments on commit da4d25e

Please sign in to comment.