summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2013-02-23 20:14:47 -0800
committerChris Buechler <cmb@pfsense.org>2013-02-23 20:14:47 -0800
commitecbf63f0c1e738b46fc05e9108bd16c40b5a0b59 (patch)
tree23104a222f84f810614d61a29f3522d8e8e0d1af
parenta6b14d7e66cfa8feed7087d11a8810b680dcff59 (diff)
parentf5e293e6707b34a9e68b6cfc4a9fb0563648ce4e (diff)
downloadpfsense-ecbf63f0c1e738b46fc05e9108bd16c40b5a0b59.zip
pfsense-ecbf63f0c1e738b46fc05e9108bd16c40b5a0b59.tar.gz
Merge pull request #433 from phil-davis/master
Cleanup code handling 25 day dyndns update
-rw-r--r--etc/inc/dyndns.class16
1 files changed, 8 insertions, 8 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index ba96b52..82b8197 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -96,6 +96,7 @@
var $_dnsResultMatch;
var $_dnsRequestIf;
var $_dnsRequestIfIP;
+ var $_dnsMaxCacheAgeDays;
/*
* Public Constructor Function (added 12 July 05) [beta]
@@ -160,6 +161,7 @@
$this->_dnsRequestIf = get_failover_interface($dnsRequestIf);
log_error("DynDNS ({$this->_dnsHost}): running get_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}");
$this->_dnsRequestIfIP = get_interface_ip($dnsRequestIf);
+ $this->_dnsMaxCacheAgeDays = 25;
// Ensure that we were able to lookup the IP
if(!is_ipaddr($this->_dnsIP)) {
@@ -997,7 +999,7 @@
$status = "Route 53: (Error) Invalid TTL";
break;
case 10:
- $error = 'phpDynDNS: No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.';
+ $error = 'phpDynDNS: No change in my IP address and/or ' . $this->_dnsMaxCacheAgeDays . ' days has not passed. Not updating dynamic DNS entry.';
break;
default:
$error = "phpDynDNS: (ERROR!) Unknown Response.";
@@ -1047,10 +1049,8 @@
}
log_error($log_error);
- /* use 2419200 for dyndns, dhs, easydns, noip, hn
- * zoneedit, dyns, ods
- */
- $time = '2160000';
+ // Convert seconds = days * hr/day * min/hr * sec/min
+ $maxCacheAgeSecs = $this->_dnsMaxCacheAgeDays * 24 * 60 * 60;
$needs_updating = FALSE;
/* lets determine if the item needs updating */
@@ -1059,10 +1059,10 @@
$update_reason = "DynDns: cacheIP != wan_ip. Updating. ";
$update_reason .= "Cached IP: {$cacheIP} WAN IP: {$wan_ip} ";
}
- if (($currentTime - $cacheTime) > $time ) {
+ if (($currentTime - $cacheTime) > $maxCacheAgeSecs) {
$needs_updating = true;
- $update_reason = "DynDns: More than 25 days. Updating. ";
- $update_reason .= "{$currentTime} - {$cacheTime} > {$time} ";
+ $update_reason = "DynDns: More than " . $this->_dnsMaxCacheAgeDays . " days. Updating. ";
+ $update_reason .= "{$currentTime} - {$cacheTime} > {$maxCacheAgeSecs} ";
}
if ($initial == true) {
$needs_updating = true;
OpenPOWER on IntegriCloud