summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-05-07 13:41:58 +0000
committerErmal <eri@pfsense.org>2010-05-07 13:41:58 +0000
commita842e988514b8f4bef77f9b1eec16f5b562f3b82 (patch)
tree6126a3a6491547dd6d4fb4d777ef37d4d6fedfba /etc
parente08e4ebc69b13c239f8aec4ece66005ea184d931 (diff)
downloadpfsense-a842e988514b8f4bef77f9b1eec16f5b562f3b82.zip
pfsense-a842e988514b8f4bef77f9b1eec16f5b562f3b82.tar.gz
Ticket #408. Provide code to upgrade static routes.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/upgrade_config.inc26
1 files changed, 26 insertions, 0 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc
index c217341..8305922 100644
--- a/etc/inc/upgrade_config.inc
+++ b/etc/inc/upgrade_config.inc
@@ -800,6 +800,32 @@ function upgrade_042_to_043() {
function upgrade_043_to_044() {
global $config;
+
+ /* migrate static routes to the new gateways config */
+ $gateways = return_gateways_array(true);
+ if (is_array($config['staticroutes']['route'])) {
+ foreach ($config['staticroutes']['route'] as $idx => $sroute) {
+ $found = false;
+ foreach ($gateways as $gwname => $gw) {
+ if ($gw['gateway'] == $sroute['gateway']) {
+ $config['staticroutes']['route'][$idx]['gateway'] = $gwname;
+ $found = true;
+ break;
+ }
+ }
+ if ($found == false) {
+ $gateway = array();
+ $gateway['name'] = "SROUTE{$sroute['gateway']}";
+ $gateway['gateway'] = $sroute['gateway'];
+ $gateway['interface'] = $sroute['interface'];
+ $gateway['descr'] = "Upgraded static route for {$sroute['network']}";
+ if (!is_array($config['gateways']['gateway_item']))
+ $config['gateways']['gateway_item'] = array();
+ $config['gateways']['gateway_item'][] = $gateway;
+ $config['staticroutes']['route'][$idx]['gateway'] = $gateway['name'];
+ }
+ }
+ }
}
OpenPOWER on IntegriCloud