summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-12-12 14:51:03 +0000
committerErmal Luçi <eri@pfsense.org>2009-12-12 14:51:03 +0000
commit1b6650903ac0770344012baee77c145b48d7b488 (patch)
tree6d68b94125364b100008a22fb338701a20d1ef37
parentc1aa682e6d5b0b22080bee4eb33459e4b8059d20 (diff)
downloadpfsense-1b6650903ac0770344012baee77c145b48d7b488.zip
pfsense-1b6650903ac0770344012baee77c145b48d7b488.tar.gz
Only get ip address from internet if it is a private address on the interface. This should optimize the speed of dyndns a lot.
-rw-r--r--etc/inc/dyndns.class13
1 files changed, 6 insertions, 7 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index af48efe..daa98ab 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -893,12 +893,10 @@
log_error("DynDns: _checkIP() starting.");
- $hosttocheck = "checkip.dyndns.org";
- $checkip = gethostbyname($hosttocheck);
- if ($hosttocheck == $checkip) {
- $ip_address = find_interface_ip($this->_if);
- log_error("DynDns debug information: {$ip_address} extracted from local system.");
- } else {
+ $ip_address = find_interface_ip($this->if);
+ if (is_private_ip($ip_address)) {
+ $hosttocheck = "checkip.dyndns.org";
+ $checkip = gethostbyname($hosttocheck);
$ip_ch = curl_init("http://{$checkip}");
curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
@@ -909,7 +907,8 @@
preg_match('=Current IP Address: (.*)</body>=siU', $ip_result_decoded, $matches);
$ip_address = trim($matches[1]);
log_error("DynDns debug information: {$ip_address} extracted from {$hosttocheck}");
- }
+ } else
+ log_error("DynDns debug information: {$ip_address} extracted from local system.");
return $ip_address;
}
OpenPOWER on IntegriCloud