diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 8c76128d0..7bd342cb9 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -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']; diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index e3067d6e7..f560b3895 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -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); diff --git a/etc/phpshellsessions/enablecarp b/etc/phpshellsessions/enablecarp index b1c4a43e4..c02a606d6 100644 --- a/etc/phpshellsessions/enablecarp +++ b/etc/phpshellsessions/enablecarp @@ -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; } } diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php index 869cc1b10..5701ad744 100644 --- a/usr/local/www/carp_status.php +++ b/usr/local/www/carp_status.php @@ -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(); diff --git a/usr/local/www/firewall_virtual_ip.php b/usr/local/www/firewall_virtual_ip.php index f4aa0d353..f3703f98b 100644 --- a/usr/local/www/firewall_virtual_ip.php +++ b/usr/local/www/firewall_virtual_ip.php @@ -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) {