dyndns - remove dyndns references as they should manage themselves. closes https://github.com/opnsense/core/issues/5434

This commit is contained in:
Ad Schellevis 2022-01-17 14:48:37 +01:00
parent aa2625998d
commit e1a3c402fc
2 changed files with 0 additions and 75 deletions

View File

@ -70,24 +70,6 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
$found_host = true;
}
if (isset($config['dyndnses']['dyndns']) && !$found_host) {
foreach ($config['dyndnses']['dyndns'] as $dyndns) {
if (strcasecmp($dyndns['host'], $http_host) == 0) {
$found_host = true;
break;
}
}
}
if (isset($config['dnsupdates']['dnsupdate']) && !$found_host) {
foreach ($config['dnsupdates']['dnsupdate'] as $rfc2136) {
if (strcasecmp($rfc2136['host'], $http_host) == 0) {
$found_host = true;
break;
}
}
}
if (!empty($config['system']['webgui']['althostnames']) && !$found_host) {
$althosts = explode(" ", $config['system']['webgui']['althostnames']);
foreach ($althosts as $ah) {
@ -141,24 +123,6 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
}
}
if (isset($config['dyndnses']['dyndns']) && !$found_host) {
foreach ($config['dyndnses']['dyndns'] as $dyndns) {
if (strcasecmp($dyndns['host'], $referrer_host) == 0) {
$found_host = true;
break;
}
}
}
if (isset($config['dnsupdates']['dnsupdate']) && !$found_host) {
foreach ($config['dnsupdates']['dnsupdate'] as $rfc2136) {
if (strcasecmp($rfc2136['host'], $referrer_host) == 0) {
$found_host = true;
break;
}
}
}
if (!$found_host) {
$found_host = isAuthLocalIP($referrer_host);
if ($referrer_host == "127.0.0.1" || $referrer_host == "localhost") {

View File

@ -1359,45 +1359,6 @@ function dhcp6c_duid_clear()
@unlink('/conf/dhcp6c_duid');
}
function get_dyndns_ip($int, $ipver = 4)
{
$ip_address = $ipver == 6 ? get_interface_ipv6($int) : get_interface_ip($int);
if (empty($ip_address)) {
log_error("Aborted IPv{$ipver} detection: no address for {$int}");
return 'down';
}
if ($ipver != 6 && is_private_ip($ip_address)) {
/* Chinese alternative is http://ip.3322.net/ */
$hosttocheck = 'http://checkip.dyndns.org';
$ip_ch = curl_init($hosttocheck);
curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address);
curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ip_ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$ip_result = curl_exec($ip_ch);
if ($ip_result !== false) {
preg_match('=<body>Current IP Address: (.*)</body>=siU', $ip_result, $matches);
$ip_address = trim($matches[1]);
} else {
log_error('Aborted IPv4 detection: ' . curl_error($ip_ch));
$ip_address = '';
}
curl_close($ip_ch);
} elseif ($ipver == 6 && is_linklocal($ip_address)) {
log_error('Aborted IPv6 detection: cannot bind to link-local address');
$ip_address = '';
}
if (($ipver == 6 && !is_ipaddrv6($ip_address)) || ($ipver != 6 && !is_ipaddrv4($ip_address))) {
return 'down';
}
return $ip_address;
}
/**
* check if interface is assigned
* @param $interface technical interface name