summaryrefslogtreecommitdiffstats
path: root/etc/inc/interfaces.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r--etc/inc/interfaces.inc64
1 files changed, 33 insertions, 31 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 6703666..967326f 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -99,6 +99,7 @@ function does_vip_exist($vip) {
switch ($vip['mode']) {
case "carp":
case "ipalias":
+ /* XXX: Make proper checks? */
$realif = get_real_interface($vip['interface']);
if (!does_interface_exist($realif)) {
return false;
@@ -427,7 +428,7 @@ function interfaces_bridge_configure($checkmember = 0) {
if(empty($bridge['bridgeif']))
$bridge['bridgeif'] = "bridge{$i}";
if ($checkmember == 1) {
- if (strstr($bridge['if'], "@"))
+ if (strstr($bridge['if'], "_vip"))
continue;
$members = explode(',', $bridge['members']);
foreach ($members as $member) {
@@ -436,7 +437,7 @@ function interfaces_bridge_configure($checkmember = 0) {
}
}
else if ($checkmember == 2) {
- if (strstr($bridge['if'], "@"))
+ if (strstr($bridge['if'], "_vip"))
continue;
$members = explode(',', $bridge['members']);
foreach ($members as $member) {
@@ -814,13 +815,13 @@ function interfaces_gre_configure($checkparent = 0) {
if(empty($gre['greif']))
$gre['greif'] = "gre{$i}";
if ($checkparent == 1) {
- if (strstr($gre['if'], "@"))
+ if (strstr($gre['if'], "_vip"))
continue;
if (!empty($config['interfaces'][$gre['if']]) && $config['interfaces'][$gre['if']]['ipaddrv6'] == "track6")
continue;
}
else if ($checkparent == 2) {
- if (strstr($gre['if'], "@"))
+ if (strstr($gre['if'], "_vip"))
continue;
if (empty($config['interfaces'][$gre['if']]) || $config['interfaces'][$gre['if']]['ipaddrv6'] != "track6")
continue;
@@ -888,13 +889,13 @@ function interfaces_gif_configure($checkparent = 0) {
if(empty($gif['gifif']))
$gre['gifif'] = "gif{$i}";
if ($checkparent == 1) {
- if (strstr($gif['if'], "@"))
+ if (strstr($gif['if'], "_vip"))
continue;
if (!empty($config['interfaces'][$gif['if']]) && $config['interfaces'][$gif['if']]['ipaddrv6'] == "track6")
continue;
}
else if ($checkparent == 2) {
- if (strstr($gif['if'], "@"))
+ if (strstr($gif['if'], "_vip"))
continue;
if (empty($config['interfaces'][$gif['if']]) || $config['interfaces'][$gif['if']]['ipaddrv6'] != "track6")
continue;
@@ -1148,6 +1149,7 @@ function interface_vip_bring_down($vip) {
}
break;
case "carp":
+ /* XXX: Is enough to delete ip address? */
if (does_interface_exist($vipif))
pfSense_interface_deladdress($vipif, $vip['subnet']);
break;
@@ -4011,16 +4013,6 @@ function get_current_wan_address($interface = "wan") {
function convert_real_interface_to_friendly_interface_name($interface = "wan") {
global $config;
- if (stristr($interface, "@")) {
- foreach ($config['virtualip']['vip'] as $counter => $vip) {
- if ($vip['mode'] == "carp") {
- $carpif = get_real_interface($vip['interface']) . "@{$vip['vhid']}";
- if ($interface == $carpif)
- return $vip['interface'];
- }
- }
- }
-
/* XXX: For speed reasons reference directly the interface array */
$ifdescrs = &$config['interfaces'];
//$ifdescrs = get_configured_interface_list(false, true);
@@ -4072,12 +4064,11 @@ function convert_friendly_interface_to_friendly_descr($interface) {
else
$ifdesc = strtoupper($config['interfaces'][$interface]['descr']);
break;
- } else if (stristr($interface, "@")) {
+ } else if (stristr($interface, "_vip")) {
if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $counter => $vip) {
if ($vip['mode'] == "carp") {
- $carpif = get_real_interface($vip['interface']) . "@{$vip['vhid']}";
- if ($interface == $carpif)
+ if ($interface == "{$vip['interface']}_vip{$vip['vhid']}")
return "{$vip['subnet']} - {$vip['descr']}";
}
}
@@ -4765,8 +4756,8 @@ function ip_in_interface_alias_subnet($interface, $ipalias) {
function get_interface_ip($interface = "wan") {
$realif = get_failover_interface($interface);
if (!$realif) {
- if (preg_match("/^carp/i", $interface))
- $realif = $interface;
+ if (strstr($interface, "_vip"))
+ return get_configured_carp_interface_list($interface);
else
return null;
}
@@ -4782,8 +4773,12 @@ function get_interface_ipv6($interface = "wan", $flush = false) {
global $config;
$realif = get_failover_interface($interface, "inet6");
- if (!$realif)
- return null;
+ if (!$realif) {
+ if (strstr($interface, "_vip"))
+ return get_configured_carp_interface_list($interface, "inet6");
+ else
+ return null;
+ }
/*
* NOTE: On the case when only the prefix is requested,
@@ -4817,9 +4812,10 @@ function get_interface_linklocal($interface = "wan") {
$realif = get_failover_interface($interface, "inet6");
if (!$realif) {
- if (preg_match("/^carp/i", $interface))
- $realif = $interface;
- else
+ if (strstr($interface, "_vip")) {
+ list($interface, $vhid) = explode("_vip", $interface);
+ $realif = get_real_interface($interface);
+ } else
return null;
}
@@ -4833,9 +4829,10 @@ function get_interface_linklocal($interface = "wan") {
function get_interface_subnet($interface = "wan") {
$realif = get_real_interface($interface);
if (!$realif) {
- if (preg_match("/^carp/i", $interface))
- $realif = $interface;
- else
+ if (strstr($interface, "_vip")) {
+ list($interface, $vhid) = explode("_vip", $interface);
+ $realif = get_real_interface($interface);
+ } else
return null;
}
@@ -4850,8 +4847,13 @@ function get_interface_subnetv6($interface = "wan") {
global $config;
$realif = get_real_interface($interface, "inet6");
- if (!$realif)
- return null;
+ if (!$realif) {
+ if (strstr($interface, "_vip")) {
+ list($interface, $vhid) = explode("_vip", $interface);
+ $realif = get_real_interface($interface);
+ } else
+ return null;
+ }
$cursn = find_interface_subnetv6($realif);
if (!empty($cursn))
OpenPOWER on IntegriCloud