diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-04-25 14:05:52 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-04-25 14:05:52 -0300 |
commit | 67273d727b3beba864d2f741ca978ccebd981db7 (patch) | |
tree | 956bcf82498e7d28dedebffb373b0ecd632231f9 /etc | |
parent | 1ccccb84f618cc12ce113be8f3b1434b07f8744c (diff) | |
parent | 8dcf0a577a9d955602e41054f7a8c34f3bc3b283 (diff) | |
download | pfsense-67273d727b3beba864d2f741ca978ccebd981db7.zip pfsense-67273d727b3beba864d2f741ca978ccebd981db7.tar.gz |
Merge pull request #1105 from florian-asche/RELENG_2_1
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/dyndns.class | 3 | ||||
-rw-r--r-- | etc/inc/services.inc | 18 |
2 files changed, 13 insertions, 8 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 8f96c39..7d3aa70 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -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); diff --git a/etc/inc/services.inc b/etc/inc/services.inc index 570e987..a99cc4d 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -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"; |