diff options
author | smos <seth.mos@dds.nl> | 2012-06-03 13:00:23 +0200 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2012-06-03 13:00:23 +0200 |
commit | bf001dec385b1b733a01ca07fdc9946ae994c63e (patch) | |
tree | 704407a028674d678a1a180014a7cfa3cca011e8 /etc/inc | |
parent | 3e1eec5850cdd50974190146459c9361fe156ff5 (diff) | |
download | pfsense-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')
-rw-r--r-- | etc/inc/dyndns.class | 5 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 25 |
2 files changed, 25 insertions, 5 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index e5ae147..9b97781 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -153,11 +153,12 @@ $this->_dnsMX = $dnsMX; $this->_dnsZoneID = $dnsZoneID; $this->_dnsTTL = $dnsTTL; - $this->_if = get_real_interface($dnsIf); + $this->_if = get_failover_interface($dnsIf); $this->_checkIP(); $this->_dnsUpdateURL = $dnsUpdateURL; $this->_dnsResultMatch = $dnsResultMatch; - $this->_dnsRequestIf = get_real_interface($dnsRequestIf); + $this->_dnsRequestIf = get_failover_interface($dnsRequestIf); + log_error("running get_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}"); $this->_dnsRequestIfIP = get_interface_ip($dnsRequestIf); // Ensure that we where able to lookup the IP 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; +} + ?> |