mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/dyndns: sandbox get_failover_interface() here
This commit is contained in:
@@ -203,3 +203,27 @@ function dyndns_configure_do($verbose = false, $int = '')
|
||||
echo "done.\n";
|
||||
}
|
||||
}
|
||||
|
||||
function dyndns_failover_interface($interface, $family = 'all')
|
||||
{
|
||||
global $config;
|
||||
|
||||
/* shortcut for known interfaces */
|
||||
if (isset($config['interfaces'][$interface])) {
|
||||
return get_real_interface($interface, $family);
|
||||
}
|
||||
|
||||
/* compare against gateway groups */
|
||||
$a_groups = return_gateway_groups_array();
|
||||
if (isset($a_groups[$interface])) {
|
||||
/* we found a gateway group, fetch the interface or vip */
|
||||
if ($a_groups[$interface][0]['vip'] != '') {
|
||||
return $a_groups[$interface][0]['vip'];
|
||||
} else {
|
||||
return $a_groups[$interface][0]['int'];
|
||||
}
|
||||
}
|
||||
|
||||
/* fall through to get real interface the hard way */
|
||||
return get_real_interface($interface, $family);
|
||||
}
|
||||
|
||||
@@ -259,13 +259,13 @@ class updatedns
|
||||
$this->_dnsMX = $dnsMX;
|
||||
$this->_dnsZoneID = $dnsZoneID;
|
||||
$this->_dnsTTL = $dnsTTL;
|
||||
$this->_if = get_failover_interface($dnsIf, $this->_useIPv6 ? 'inet6' : 'all');
|
||||
$this->_if = dyndns_failover_interface($dnsIf, $this->_useIPv6 ? 'inet6' : 'all');
|
||||
$this->_checkIP();
|
||||
$this->_dnsUpdateURL = $dnsUpdateURL;
|
||||
$this->_dnsResultMatch = $dnsResultMatch;
|
||||
$this->_dnsRequestIf = get_failover_interface($dnsRequestIf, $this->_useIPv6 ? 'inet6' : 'all');
|
||||
$this->_dnsRequestIf = dyndns_failover_interface($dnsRequestIf, $this->_useIPv6 ? 'inet6' : 'all');
|
||||
if ($this->_dnsVerboseLog) {
|
||||
log_error("Dynamic DNS ({$this->_dnsHost}): running get_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}");
|
||||
log_error("Dynamic DNS ({$this->_dnsHost}): running dyndns_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}");
|
||||
}
|
||||
$this->_dnsRequestIfIP = get_interface_ip($dnsRequestIf);
|
||||
$this->_dnsMaxCacheAgeDays = 25;
|
||||
|
||||
Reference in New Issue
Block a user