Ticket #3967. Allow to have carp as parent of ipaliases - continued

This commit is contained in:
Ermal 2014-11-10 15:00:30 +01:00
parent 9c97df267f
commit 5063f1df93
5 changed files with 27 additions and 4 deletions

View File

@ -3641,7 +3641,7 @@ function filter_generate_ipsec_rules($log = array()) {
}
}
if (strstr($ph1ent['interface'], "_vip"))
if (strpos($ph1ent['interface'], "_vip"))
list($parentinterface, $vhid) = explode("_vhid", $ph1ent['interface']);
else
$parentinterface = $ph1ent['interface'];

View File

@ -4151,6 +4151,15 @@ function get_current_wan_address($interface = "wan") {
function convert_real_interface_to_friendly_interface_name($interface = "wan") {
global $config;
if (stripos($interface, "_vip")) {
foreach ($config['virtualip']['vip'] as $counter => $vip) {
if ($vip['mode'] == "carp") {
if ($interface == "{$vip['interface']}_vip{$vip['vhid']}")
return $vip['interface'];
}
}
}
/* XXX: For speed reasons reference directly the interface array */
$ifdescrs = &$config['interfaces'];
//$ifdescrs = get_configured_interface_list(false, true);

View File

@ -7,9 +7,13 @@ if(is_array($config['virtualip']['vip'])) {
$viparr = &$config['virtualip']['vip'];
foreach ($viparr as $vip) {
switch ($vip['mode']) {
case "carp":
interface_carp_configure($vip);
sleep(1);
case "carp":
interface_carp_configure($vip);
sleep(1);
break;
case "ipalias":
if (strpos($vip['interface'], '_vip'))
interface_ipalias_configure($vip);
break;
}
}

View File

@ -81,6 +81,10 @@ if($_POST['disablecarp'] <> "") {
sleep(1);
break;
}
case 'ipalias':
if (strpos($vip['interface'], '_vip'))
interface_ipalias_configure($vip);
break;
}
}
interfaces_sync_setup();

View File

@ -162,6 +162,12 @@ if ($_GET['act'] == "del") {
if ($found_carp === true && $found_other_alias === false && $found_if === false)
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by a CARP IP with the description") . " {$vip['descr']}.";
} else if ($a_vip[$_GET['id']]['mode'] == "carp") {
$vipiface = "{$a_vip[$_GET['id']]['interface']}_vip{$a_vip[$_GET['id']]['vhid']}";
foreach ($a_vip as $vip) {
if ($vipiface == $vip['interface'] && $vip['mode'] == "ipalias")
$input_errors[] = gettext("This entry cannot be deleted because it is still referenced by an IP alias entry with the description") . " {$vip['descr']}.";
}
}
if (!$input_errors) {