diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2012-05-23 16:50:35 -0600 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2012-05-23 17:01:38 -0600 |
commit | e820da2a9318b95336febaf2d4bfb8c370ef985c (patch) | |
tree | 16358b05aaa4fc4fe33853d95af8effb94120ca7 /etc/inc/upgrade_config.inc | |
parent | 79f4bb0b505c2be34a75c768a48760abe3f8d14d (diff) | |
download | pfsense-e820da2a9318b95336febaf2d4bfb8c370ef985c.zip pfsense-e820da2a9318b95336febaf2d4bfb8c370ef985c.tar.gz |
Fix reference updating for when more than one carp vip exists. Skip the upgrade code if no carp vip defined. Ticket #2445
Diffstat (limited to 'etc/inc/upgrade_config.inc')
-rw-r--r-- | etc/inc/upgrade_config.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 319fbbd..5821c24 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2793,17 +2793,21 @@ function upgrade_085_to_086() { global $config, $g; /* XXX: Gross hacks in sight */ - write_config(); if (is_array($config['virtualip']['vip'])) { $vipchg = array(); foreach ($config['virtualip']['vip'] as $vip) { if ($vip['mode'] != "carp") continue; - file_put_contents("{$g['tmp_path']}/vipreplace", "s/\\([^_]\\)vip{$vip['vhid']}\\([^0-9]\\)/\\1{$vip['interface']}_vip{$vip['vhid']}\\2/g\n"); + $vipchg[] = "s/\\([^_]\\)vip{$vip['vhid']}\\([^0-9]\\)/\\1{$vip['interface']}_vip{$vip['vhid']}\\2/g\n"; + } + if (!empty($vipchg)) { + file_put_contents("{$g['tmp_path']}/vipreplace", $vipchg); + write_config(); + mwexec("/usr/bin/sed -I \"\" -f {$g['tmp_path']}/vipreplace /conf/config.xml"); + require_once("config.lib.inc"); + $config = parse_config(true); + @unlink("{$g['tmp_path']}/vipreplace"); } - mwexec("/usr/bin/sed -I \"\" -f {$g['tmp_path']}/vipreplace /conf/config.xml"); - require_once("config.lib.inc"); - $config = parse_config(true); } } |