summaryrefslogtreecommitdiffstats
path: root/etc/inc/interfaces.inc
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2012-06-03 13:00:23 +0200
committersmos <seth.mos@dds.nl>2012-06-03 13:00:23 +0200
commitbf001dec385b1b733a01ca07fdc9946ae994c63e (patch)
tree704407a028674d678a1a180014a7cfa3cca011e8 /etc/inc/interfaces.inc
parent3e1eec5850cdd50974190146459c9361fe156ff5 (diff)
downloadpfsense-bf001dec385b1b733a01ca07fdc9946ae994c63e.zip
pfsense-bf001dec385b1b733a01ca07fdc9946ae994c63e.tar.gz
Allow for failover DynDNS hostnames.
replace get_real_interface() calls with get_failover_interface. If it isn't a group we call get_real_interface() anyhow. We can't put the logic inside get_real_interface() as this would create a recursion Redmine ticket #1965
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r--etc/inc/interfaces.inc25
1 files changed, 22 insertions, 3 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 86184dd..679ae1d 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -3814,6 +3814,7 @@ function get_real_interface($interface = "wan") {
$wanif = $interface;
break;
}
+
if (empty($config['interfaces'][$interface]))
break;
@@ -4320,7 +4321,7 @@ function ip_in_interface_alias_subnet($interface, $ipalias) {
function get_interface_ip($interface = "wan")
{
- $realif = get_real_interface($interface);
+ $realif = get_failover_interface($interface);
if (!$realif) {
if (preg_match("/^carp/i", $interface))
$realif = $interface;
@@ -4340,7 +4341,7 @@ function get_interface_ip($interface = "wan")
function get_interface_ipv6($interface = "wan")
{
global $config;
- $realif = get_real_interface($interface);
+ $realif = get_failover_interface($interface);
switch($config['interfaces'][$interface]['ipaddrv6']) {
case "6rd":
case "6to4":
@@ -4365,7 +4366,7 @@ function get_interface_ipv6($interface = "wan")
function get_interface_linklocal($interface = "wan")
{
- $realif = get_real_interface($interface);
+ $realif = get_failover_interface($interface);
if (!$realif) {
if (preg_match("/^carp/i", $interface))
$realif = $interface;
@@ -4767,4 +4768,22 @@ function interfaces_staticarp_configure($if) {
return 0;
}
+function get_failover_interface($interface) {
+ global $config;
+ /* compare against gateway groups */
+ $a_groups = return_gateway_groups_array();
+ if(is_array($a_groups[$interface])) {
+ /* we found a gateway group, fetch the interface or vip */
+ if($a_groups[$interface][0]['vip'] <> "")
+ $wanif = $a_groups[$interface][0]['vip'];
+ else
+ $wanif = $a_groups[$interface][0]['int'];
+
+ return $wanif;
+ }
+ /* fall through to get_real_interface */
+ $wanif = get_real_interface($interface);
+ return $wanif;
+}
+
?>
OpenPOWER on IntegriCloud