wizard: may end up duplicating WAN_GW which is bad

PR: https://forum.opnsense.org/index.php?topic=33864.0
This commit is contained in:
Franco Fichtner 2023-05-10 15:48:12 +02:00
parent 0a3ac8fb66
commit db69027dda
1 changed files with 5 additions and 6 deletions

View File

@ -612,19 +612,18 @@ if (!empty($config['wizardtemp']['wangateway'])) {
$found = false;
$defaultgw_found = false;
foreach ($config['gateways']['gateway_item'] as & $gw) {
if ($gw['interface'] != "wan")
continue;
if (isset($gw['defaultgw']))
if (isset($gw['defaultgw'])) {
$defaultgw_found = true;
if ($gw['name'] == 'WAN_GW' || (!empty($config['wizardtemp']['wangateway']) && $gw['gateway'] == $config['wizardtemp']['wangateway'])) {
}
if ($gw['name'] == 'WAN_GW') {
$found = true;
$gw['gateway'] = $config['wizardtemp']['wangateway'];
$config['interfaces']['wan']['gateway'] = $gw['name'];
}
}
if (!$found) {
$newgw = array();
$newgw['interface'] = "wan";
$newgw = [];
$newgw['interface'] = 'wan';
$newgw['gateway'] = $config['wizardtemp']['wangateway'];
$newgw['name'] = 'WAN_GW';
$newgw['weight'] = 1;