diff options
author | jim-p <jimp@pfsense.org> | 2011-02-28 12:14:53 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-02-28 12:16:10 -0500 |
commit | e121bebdceb095d5b905dc184c1a189f054c3656 (patch) | |
tree | 42728c9649b6458df98693f2161c9244344c83b1 /usr/local/www | |
parent | 2d539f40041c1983eed14d34db3244d7fded0d5d (diff) | |
download | pfsense-e121bebdceb095d5b905dc184c1a189f054c3656.zip pfsense-e121bebdceb095d5b905dc184c1a189f054c3656.tar.gz |
Fix gateway handling in setup wizard.
Diffstat (limited to 'usr/local/www')
-rw-r--r-- | usr/local/www/wizards/setup_wizard.xml | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index 5a33d39..50e1777 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -256,7 +256,7 @@ </field> <field> <name>Gateway</name> - <bindstofield>interfaces->wan->gateway</bindstofield> + <bindstofield>wizardtemp->wangateway</bindstofield> <type>input</type> <validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate> <message>Gateway IP Address field is invalid</message> @@ -387,6 +387,11 @@ <stepbeforeformdisplay> <![CDATA[ $config['interfaces']['tmp'] = array(); + + if (is_array($config['gateways']['gateway_item'])) + foreach ($config['gateways']['gateway_item'] as $gw) + if ($gw['name'] == 'WANGW') + $config['wizardtemp']['wangateway'] = $gw['gateway']; ]]> </stepbeforeformdisplay> <stepsubmitphpaction> @@ -554,12 +559,34 @@ <description>A reload is now in progress. Please wait. <p> The system will automatically try to access $myurl in 120 seconds. <p> You can click on the icon above to access the site more quickly. <meta http-equiv="refresh" content="60; url=$myurl" ></description> <stepafterformdisplay> + <![CDATA[ $config['system']['hostname'] = $config['wizardtemp']['system']['hostname']; $config['system']['domain'] = $config['wizardtemp']['system']['domain']; + if (!is_array($config['gateways']['gateway_item'])) + $config['gateways']['gateway_item'] = array(); + $found = false; + foreach ($config['gateways']['gateway_item'] as & $gw) { + if ($gw['name'] == 'WANGW') { + $found = true; + $gw['gateway'] = $config['wizardtemp']['wangateway']; + } + } + if (!$found) { + $newgw = array(); + $newgw['interface'] = "wan"; + $newgw['gateway'] = $config['wizardtemp']['wangateway']; + $newgw['name'] = "WANGW"; + $newgw['weight'] = 1; + $newgw['descr'] = "WAN Gateway"; + $newgw['defaultgw'] = true; + $config['gateways']['gateway_item'][] = $newgw; + } + $config['interfaces']['wan']['gateway'] = "WANGW"; unset($config['wizardtemp']); write_config(); reload_all(); - mwexec_bg("/etc/rc.update_bogons.sh now"); + mwexec_bg("/etc/rc.update_bogons.sh now"); + ]]> </stepafterformdisplay> </step> </pfsensewizard> |