Revision c14781e3
Added by Renato Botelho over 10 years ago
usr/local/www/xmlrpc.php | ||
---|---|---|
211 | 211 |
if (isset($params[0]['virtualip'])) { |
212 | 212 |
if (is_array($config['virtualip']['vip'])) { |
213 | 213 |
foreach ($config['virtualip']['vip'] as $vipindex => $vip) { |
214 |
if ($vip['mode'] == "carp") |
|
215 |
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}"; |
|
216 |
else if ($vip['mode'] == "ipalias" && (substr($vip['interface'], 0, 4) == '_vip') || strpos($vip['interface'], "lo0")) |
|
217 |
$oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}"; |
|
218 |
else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strpos($vip['interface'], "lo0")) |
|
214 |
if ($vip['mode'] == "carp") { |
|
215 |
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}"; |
|
216 |
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['interface'] = $vip['interface']; |
|
217 |
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['subnet'] = $vip['subnet']; |
|
218 |
} else if ($vip['mode'] == "ipalias" && (substr($vip['interface'], 0, 4) == '_vip' || strpos($vip['interface'], "lo0"))) { |
|
219 |
$oldvips[$vip['subnet']]['content'] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}"; |
|
220 |
$oldvips[$vip['subnet']]['interface'] = $vip['interface']; |
|
221 |
$oldvips[$vip['subnet']]['subnet'] = $vip['subnet']; |
|
222 |
} else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(substr($vip['interface'], 0, 4) == '_vip') || strpos($vip['interface'], "lo0")) { |
|
219 | 223 |
$vipbackup[] = $vip; |
224 |
} |
|
220 | 225 |
} |
221 | 226 |
} |
222 | 227 |
} |
... | ... | |
247 | 252 |
$anyproxyarp = false; |
248 | 253 |
foreach ($config['virtualip']['vip'] as $vip) { |
249 | 254 |
if ($vip['mode'] == "carp" && isset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"])) { |
250 |
if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") { |
|
255 |
if ($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]['content'] == "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}") {
|
|
251 | 256 |
if (does_vip_exist($vip)) { |
252 | 257 |
unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]); |
253 | 258 |
continue; // Skip reconfiguring this vips since nothing has changed. |
... | ... | |
255 | 260 |
} |
256 | 261 |
unset($oldvips["{$vip['interface']}_vip{$vip['vhid']}"]); |
257 | 262 |
} else if ($vip['mode'] == "ipalias" && strstr($vip['interface'], "_vip") && isset($oldvips[$vip['subnet']])) { |
258 |
if ($oldvips[$vip['subnet']] == "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") { |
|
263 |
if ($oldvips[$vip['subnet']]['content'] == "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}") {
|
|
259 | 264 |
if (does_vip_exist($vip)) { |
260 | 265 |
unset($oldvips[$vip['subnet']]); |
261 | 266 |
continue; // Skip reconfiguring this vips since nothing has changed. |
... | ... | |
279 | 284 |
} |
280 | 285 |
} |
281 | 286 |
/* Cleanup remaining old carps */ |
282 |
foreach ($oldvips as $oldvipif => $oldvippar) {
|
|
283 |
$oldvipif = get_real_interface($oldvippar['interface']);
|
|
287 |
foreach ($oldvips as $oldvipar) { |
|
288 |
$oldvipif = get_real_interface($oldvipar['interface']); |
|
284 | 289 |
if (!empty($oldvipif)) { |
285 | 290 |
if (is_ipaddrv6($oldvipif)) |
286 | 291 |
mwexec("/sbin/ifconfig " . escapeshellarg($oldvipif) . " inet6 " . escapeshellarg($oldvipar['subnet']) . " delete"); |
Also available in: Unified diff
Save vip interface and subnet to use to delete old vips from secondary nodes. Fixes #4446