diff options
author | Ermal <eri@pfsense.org> | 2011-06-14 11:36:20 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-06-14 11:36:20 +0000 |
commit | 2708a5cf1648c6d776588e0e4b9be1b6aad65994 (patch) | |
tree | 51d639572598ff1b11655e6b186b0973341cf93a /usr/local/www/xmlrpc.php | |
parent | 7905df983103f1288fb22f6db192f3de64a0daa2 (diff) | |
download | pfsense-2708a5cf1648c6d776588e0e4b9be1b6aad65994.zip pfsense-2708a5cf1648c6d776588e0e4b9be1b6aad65994.tar.gz |
NEw functiong does_vip_exist() which works for carp and ipalias type vips to help in carp sync issues. Fixes #1598
Diffstat (limited to 'usr/local/www/xmlrpc.php')
-rwxr-xr-x | usr/local/www/xmlrpc.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index f3211df..2fbf5e3 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -166,7 +166,9 @@ function restore_config_section_xmlrpc($raw_params) { foreach ($config['virtualip']['vip'] as $vipindex => $vip) { if ($vip['mode'] == "carp") $oldvips[$vip['vhid']] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}"; - else if ((($vip['mode'] == 'ipalias') || ($vip['mode'] == 'proxyarp')) && substr($vip['interface'], 0, 3) != "vip") + else if ($vip['mode'] == "ipalias" && substr($vip['interface'], 0, 3) == "vip") + $oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}"; + else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && substr($vip['interface'], 0, 3) != "vip") $vipbackup[] = $vip; } } @@ -197,14 +199,22 @@ function restore_config_section_xmlrpc($raw_params) { $carp_setuped = false; $anyproxyarp = false; foreach ($config['virtualip']['vip'] as $vip) { - if (isset($oldvips[$vip['vhid']])) { + if ($vip['mode'] == "carp" && isset($oldvips[$vip['vhid']])) { if ($oldvips[$vip['vhid']] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") { - if (does_interface_exist("vip{$vip['vhid']}")) { + if (does_vip_exist($vip)) { unset($oldvips[$vip['vhid']]); continue; // Skip reconfiguring this vips since nothing has changed. } } unset($oldvips[$vip['vhid']]); + } else if ($vip['mode'] == "ipalias" && substr($vip['interface'], 0, 3) == "vip" && isset($oldvips[$vip['subnet']])) { + if ($oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") { + if (does_vip_exist($vip)) { + unset($oldvips[$vip['subnet']]); + continue; // Skip reconfiguring this vips since nothing has changed. + } + } + unset($oldvips[$vip['subnet']]); } switch ($vip['mode']) { @@ -226,7 +236,7 @@ function restore_config_section_xmlrpc($raw_params) { } /* Cleanup remaining old carps */ foreach ($oldvips as $oldvipif => $oldvippar) { - if (does_interface_exist("vip{$oldvipif}")) + if (!is_ipaddr($oldvipif) && does_interface_exist("vip{$oldvipif}")) pfSense_interface_destroy("vip{$oldvipif}"); } if ($carp_setuped == true) |