Skip to content

Commit ce8ef99

Browse files
committed
gwlb, gateway switch shouldn't be in the for loop
1 parent 9d23933 commit ce8ef99

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/etc/inc/gwlb.inc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,14 +738,16 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
738738
if (empty($upgw) && $gwsttng[$gwname]['friendlyiface'] != "lan" &&
739739
(isset($gwsttng['monitor_disable']) || !stristr($gateways_status[$gwname]['status'], "down"))) {
740740
$upgw = $gwname;
741-
}
742-
if (!$dfltgwup && !empty($upgw)) {
743-
// switch gateway
744-
$dfltgwname = $upgw;
745-
break;
741+
if (!$dfltgwup) {
742+
break;
743+
}
746744
}
747745
}
748746
}
747+
if (!$dfltgwup && !empty($upgw)) {
748+
// switch gateway
749+
$dfltgwname = $upgw;
750+
}
749751
if ($gateways_arr[$dfltgwname]['gateway'] == "dynamic") {
750752
if ($ipprotocol == 'inet') {
751753
$gwip = get_interface_gateway($gateways_arr[$dfltgwname]['friendlyiface']);

0 commit comments

Comments
 (0)