From ce8ef9930ba014a5efb8fb2c855e7e29a827ed4a Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 8 May 2017 08:44:52 +0200 Subject: [PATCH] gwlb, gateway switch shouldn't be in the for loop --- src/etc/inc/gwlb.inc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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']);