Merge pull request #1105 from florian-asche/RELENG_2_1

This commit is contained in:
Renato Botelho 2014-04-25 14:05:52 -03:00
commit 67273d727b
2 changed files with 13 additions and 8 deletions

View File

@ -1229,6 +1229,9 @@
curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address);
curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, '30');
curl_setopt($ip_ch, CURLOPT_TIMEOUT, 120);
if ($this->_useIPv6 == false) {
curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
$ip_result_page = curl_exec($ip_ch);
curl_close($ip_ch);
$ip_result_decoded = urldecode($ip_result_page);

View File

@ -1592,12 +1592,14 @@ function dyndnsCheckIP($int) {
// Avoid the long wait for the external check to timeout.
if (stristr($gateways_status[$config['interfaces'][$int]['gateway']]['status'],"down"))
return "down";
$hosttocheck = "checkip.dyndns.org";
$checkip = gethostbyname($hosttocheck);
$ip_ch = curl_init("http://{$checkip}");
$hosttocheck = "http://checkip.dyndns.org";
$ip_ch = curl_init($hosttocheck);
curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address);
curl_setopt($ip_ch, CURLOPT_CONNECTTIMEOUT, '30');
curl_setopt($ip_ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ip_ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$ip_result_page = curl_exec($ip_ch);
curl_close($ip_ch);
$ip_result_decoded = urldecode($ip_result_page);
@ -1988,9 +1990,12 @@ function services_dnsupdate_process($int = "", $updatehost = "", $forced = false
/* determine interface name */
$if = get_real_interface($dnsupdate['interface']);
$wanip = get_interface_ip($dnsupdate['interface']);
if (isset($dnsupdate['usepublicip']))
$wanip = dyndnsCheckIP($dnsupdate['interface']);
else
$wanip = get_interface_ip($dnsupdate['interface']);
$wanipv6 = get_interface_ipv6($dnsupdate['interface']);
$cacheFile = "{$g['conf_path']}/dyndns_{$dnsupdate['interface']}_rfc2136_" . escapeshellarg($dnsupdate['host']) . "_{$dnsupdate['server']}.cache";
$currentTime = time();
@ -2054,9 +2059,6 @@ EOD;
/* Update IPv4 if we have it. */
if (is_ipaddrv4($wanip)) {
if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) {
if (isset($dnsupdate['usepublicip'])) {
$wanip = dyndnsCheckIP($dnsupdate['interface']);
}
$upinst .= "update delete {$dnsupdate['host']}. A\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} A {$wanip}\n";
$notify_text .= sprintf(gettext("DynDNS updated IP Address (A) for {$dnsupdate['host']} on %s (%s) to %s"), convert_real_interface_to_friendly_descr($if), $if, $wanip) . "\n";