diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-04-22 01:33:23 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-04-22 01:34:49 -0500 |
commit | a81deb3913df77ecd58b8bd0e81ca742a1402643 (patch) | |
tree | c22a1db8f4b3a5737d6679e6d1b734959558f1c7 /src/etc/inc | |
parent | 1d616571820961c9a3d1590202737787d49b4ecd (diff) | |
download | pfsense-a81deb3913df77ecd58b8bd0e81ca742a1402643.zip pfsense-a81deb3913df77ecd58b8bd0e81ca742a1402643.tar.gz |
Add config upgrade code for CARP IPs on gateway groups, GRE and gif. Ticket #6222
Diffstat (limited to 'src/etc/inc')
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 2b15757..8c7495f 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4921,5 +4921,59 @@ function upgrade_152_to_153() { } } } + + // upgrade GIFs using VIP to new format + if (is_array($config['gifs']['gif'])) { + foreach ($config['gifs']['gif'] as $idx => $gif) { + if (substr($gif['if'], 0, 4) == "_vip") { + // using new VIP format + continue; + } else if (strstr($gif['if'], "_vip")) { + // using old VIP format, update + $config['gifs']['gif'][$idx]['if'] = get_vip_from_oldcarp($gif['if']); + } + } + } + + // upgrade GREs using VIP to new format + if (is_array($config['gres']['gre'])) { + foreach ($config['gres']['gre'] as $idx => $gre) { + if (substr($gre['if'], 0, 4) == "_vip") { + // using new VIP format + continue; + } else if (strstr($gre['if'], "_vip")) { + // using old VIP format, update + $config['gres']['gre'][$idx]['if'] = get_vip_from_oldcarp($gre['if']); + } + } + } + + // upgrade gateway groups using VIPs + if (is_array($config['gateways']['gateway_group'])) { + foreach ($config['gateways']['gateway_group'] as $idx => $gw) { + if (is_array($gw['item'])) { + $newitems = array(); + $gwvipchange = false; + foreach ($gw['item'] as $item) { + if (strstr($item, "|_vip")) { + // using new VIP format + $newitems[] = $item; + continue; + } else if (strstr($item, "_vip")) { + // using old VIP format, update + $gwitemarr = explode("|", $item); + $gwitemarr[2] = get_vip_from_oldcarp($gwitemarr[2]); + $newitems[] = implode("|", $gwitemarr); + $gwvipchange = true; + } else { + $newitems[] = $item; + } + } + if ($gwvipchange) { + $config['gateways']['gateway_group'][$idx]['item'] = $newitems; + } + } + } + } } ?> |