From da74e6735735155467eeaf9e9473b9d16c2a53fd Mon Sep 17 00:00:00 2001 From: Seth Mos Date: Mon, 14 Dec 2009 13:32:21 +0100 Subject: Fix the VLAN upgrade code so that it correctly renames the vlan entries and updates the interfaces config section to the new name. Tested with 2 VLANS. --- etc/inc/upgrade_config.inc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index cd8c166..925c8a0 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -783,9 +783,19 @@ function upgrade_043_to_044() { function upgrade_044_to_045() { global $config; + $iflist = get_configured_interface_list(false, true); if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { - foreach ($config['vlans']['vlan'] as $id => $vlan) - $config['vlan']['vlan'][$id]['vlanif'] = "{$vlan['if']}_vlan{$vlan['tag']}"; + foreach ($config['vlans']['vlan'] as $id => $vlan) { + $vlan['vlanif'] = "{$vlan['if']}_vlan{$vlan['tag']}"; + $config['vlans']['vlan'][$id] = $vlan; + /* Make sure to update the interfaces section with the right name */ + foreach($iflist as $ifname) { + if($config['interfaces'][$ifname]['if'] == "vlan{$id}") { + $config['interfaces'][$ifname]['if'] = $vlan['vlanif']; + } + } + + } } } @@ -1791,4 +1801,4 @@ function upgrade_059_to_060() { } } -?> \ No newline at end of file +?> -- cgit v1.1