Skip to content

Commit

Permalink
gateway failover, typo in fixup_default_gateway() leading to not swit…
Browse files Browse the repository at this point in the history
…ch no gw down

(cherry picked from commit 575c644)
(cherry picked from commit 6009ab9)
(cherry picked from commit 834ccbe)
(cherry picked from commit 5376a0e)
  • Loading branch information
AdSchellevis authored and fichtner committed May 5, 2017
1 parent 6832082 commit 2f715d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/etc/inc/gwlb.inc
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
(isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) {
$upgw = $gwname;
}
if ($dfltgwdown && !empty($upgw)) {
if (!$dfltgwup && !empty($upgw)) {
// switch gateway
$dfltgwname = $upgw;
break;
Expand All @@ -755,7 +755,8 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
} else {
$gwip = $gateways_arr[$dfltgwname]['gateway'];
}
$defaultgw = trim(exec("/sbin/route -n get -{$ipprotocol} default | /usr/bin/awk '/gateway:/ {print $2}'"), " \n");
$tmpcmd = "/sbin/route -n get -{$ipprotocol} default 2>/dev/null | /usr/bin/awk '/gateway:/ {print $2}'";
$defaultgw = trim(exec($tmpcmd), " \n");
if (!$dfltgwup) {
log_error("Default gateway down setting {$dfltgwname} as default!");
}
Expand Down Expand Up @@ -838,7 +839,7 @@ function return_gateway_groups_array()
/* process all gateways in this tier */
foreach ($tier as $member_item) {
$member = $member_item['gwname'];
if (($member_item['up'] || $tiers_online) && isset($gateways_arr[$member])) {
if (($member_item['up'] || $tiers_online == 0) && isset($gateways_arr[$member])) {
/* determine interface gateway */
$gateway = $gateways_arr[$member];
if (is_ipaddr($gateway['gateway'])) {
Expand Down

0 comments on commit 2f715d2

Please sign in to comment.