diff options
Diffstat (limited to 'etc')
-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; +} + ?> |