summaryrefslogtreecommitdiffstats
path: root/usr/local/www/wizards
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-04-28 11:12:40 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-04-28 11:12:40 -0300
commit004c14123ce789fadf281fc8b8e5222687706371 (patch)
treeb3381d1f736dda7888cb7f7623f78965381f7c8f /usr/local/www/wizards
parent79d03c40e7e75080bd4dff8af7a061421a9c6aa7 (diff)
downloadpfsense-004c14123ce789fadf281fc8b8e5222687706371.zip
pfsense-004c14123ce789fadf281fc8b8e5222687706371.tar.gz
Avoid duplicate default gw, also look for gateways with name different from WANGW that points to same IP
Diffstat (limited to 'usr/local/www/wizards')
-rw-r--r--usr/local/www/wizards/setup_wizard.xml14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml
index 513a286..1f09263 100644
--- a/usr/local/www/wizards/setup_wizard.xml
+++ b/usr/local/www/wizards/setup_wizard.xml
@@ -388,7 +388,7 @@
<![CDATA[
if (is_array($config['gateways']['gateway_item']))
foreach ($config['gateways']['gateway_item'] as $gw)
- if ($gw['name'] == 'WANGW')
+ if ($gw['name'] == 'WANGW' || (!empty($config['wizardtemp']['wangateway']) && $gw['gateway'] == $config['wizardtemp']['wangateway']))
$config['wizardtemp']['wangateway'] = $gw['gateway'];
]]>
</stepbeforeformdisplay>
@@ -573,10 +573,16 @@
if (!is_array($config['gateways']['gateway_item']))
$config['gateways']['gateway_item'] = array();
$found = false;
+ $defaultgw_found = false;
foreach ($config['gateways']['gateway_item'] as & $gw) {
- if ($gw['name'] == 'WANGW') {
+ if ($gw['interface'] != "wan")
+ continue;
+ if (isset($gw['defaultgw']))
+ $defaultgw_found = true;
+ if ($gw['name'] == 'WANGW' || (!empty($config['wizardtemp']['wangateway']) && $gw['gateway'] == $config['wizardtemp']['wangateway'])) {
$found = true;
$gw['gateway'] = $config['wizardtemp']['wangateway'];
+ $config['interfaces']['wan']['gateway'] = $gw['name'];
}
}
if (!$found) {
@@ -586,10 +592,10 @@
$newgw['name'] = "WANGW";
$newgw['weight'] = 1;
$newgw['descr'] = "WAN Gateway";
- $newgw['defaultgw'] = true;
+ $newgw['defaultgw'] = !$defaultgw_found;
$config['gateways']['gateway_item'][] = $newgw;
+ $config['interfaces']['wan']['gateway'] = "WANGW";
}
- $config['interfaces']['wan']['gateway'] = "WANGW";
}
unset($config['wizardtemp']);
write_config();
OpenPOWER on IntegriCloud