Commit 575c6440 authored by Ad Schellevis's avatar Ad Schellevis

gateway failover, typo in fixup_default_gateway() leading to not switch no gw down

parent c8ef950c
...@@ -739,7 +739,7 @@ function fixup_default_gateway($gateways_status, $gateways_arr) ...@@ -739,7 +739,7 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
(isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) { (isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) {
$upgw = $gwname; $upgw = $gwname;
} }
if ($dfltgwdown && !empty($upgw)) { if (!$dfltgwup && !empty($upgw)) {
// switch gateway // switch gateway
$dfltgwname = $upgw; $dfltgwname = $upgw;
break; break;
...@@ -755,7 +755,8 @@ function fixup_default_gateway($gateways_status, $gateways_arr) ...@@ -755,7 +755,8 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
} else { } else {
$gwip = $gateways_arr[$dfltgwname]['gateway']; $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 | /usr/bin/awk '/gateway:/ {print $2}'";
$defaultgw = trim(exec($tmpcmd), " \n");
if (!$dfltgwup) { if (!$dfltgwup) {
log_error("Default gateway down setting {$dfltgwname} as default!"); log_error("Default gateway down setting {$dfltgwname} as default!");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment