diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 7a6272143..bdfad3ffc 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -738,14 +738,16 @@ function fixup_default_gateway($gateways_status, $gateways_arr) if (empty($upgw) && $gwsttng[$gwname]['friendlyiface'] != "lan" && (isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) { $upgw = $gwname; - } - if (!$dfltgwup && !empty($upgw)) { - // switch gateway - $dfltgwname = $upgw; - break; + if (!$dfltgwup) { + break; + } } } } + if (!$dfltgwup && !empty($upgw)) { + // switch gateway + $dfltgwname = $upgw; + } if ($gateways_arr[$dfltgwname]['gateway'] == "dynamic") { if ($ipprotocol == 'inet') { $gwip = get_interface_gateway($gateways_arr[$dfltgwname]['friendlyiface']);