summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2008-07-20 19:01:40 +0000
committerErmal Luçi <eri@pfsense.org>2008-07-20 19:01:40 +0000
commit13db70b41b9b126ae804fc8cec0b17ef721c326f (patch)
treeb3913ca6387a0422f5c5795ef51162ff6abd981d
parentfd44e282789375f584fbc13a501407f4bbe751ca (diff)
downloadpfsense-13db70b41b9b126ae804fc8cec0b17ef721c326f.zip
pfsense-13db70b41b9b126ae804fc8cec0b17ef721c326f.tar.gz
* Revert cache file path to the config file one, it was braught to my attention that if we try to update very often might get blacklisted.
* Use CURLOPT_SETINTERFACE so we correctly check the ip address for each configured interface.
-rw-r--r--etc/inc/dyndns.class14
1 files changed, 6 insertions, 8 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index fa2de43..fc06303 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -87,7 +87,7 @@
global $config;
- $this->_cacheFile = "/var/etc/dyndns_{$dnsIf}{$dnsService}.cache";
+ $this->_cacheFile = "/cf/conf/dyndns_{$dnsIf}{$dnsService}.cache";
$this->_debugFile = "/var/etc/dyndns_{$dnsIf}{$dnsService}.debug";
log_error("DynDns: updatedns() starting");
@@ -118,13 +118,10 @@
$this->_dnsMX = $dnsMX;
$this->_if = $dnsIf;
- if(!$wan_ip)
- $wan_ip = get_current_wan_address($dnsIf);
-
- $this->_dnsIP = $wan_ip;
+ $this->_dnsIP = get_current_wan_address($dnsIf);
$this->_debugID = rand(1000000, 9999999);
- if ($this->_detectChange() == FALSE) {
+ if ($this->_detectChange($wan_ip) == FALSE) {
$this->_error(10);
} else {
if ($this->_dnsService == 'dnsomatic' ||
@@ -714,11 +711,11 @@
$wan_ip = $this->_checkIP();
$currentTime = time();
log_error("phpDynDNS: updating cache file {$this->_cacheFile}: {$wan_ip}");
- //conf_mount_rw();
+ conf_mount_rw();
$file = fopen($this->_cacheFile, 'w');
fwrite($file, $wan_ip.':'.$currentTime);
fclose($file);
- //conf_mount_ro();
+ conf_mount_ro();
}
$this->status = $status;
log_error($status);
@@ -856,6 +853,7 @@
$ip_ch = curl_init('http://checkip.dyndns.org');
curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ip_ch, CURLOPT_SETINTERFACE, $this->_dnsIP);
$ip_result_page = curl_exec($ip_ch);
$ip_result_decoded = urldecode($ip_result_page);
preg_match('=Current IP Address: (.*)</body>=siU', $ip_result_decoded, $matches);
OpenPOWER on IntegriCloud