summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2013-03-04 01:25:37 -0800
committerChris Buechler <cmb@pfsense.org>2013-03-04 01:25:37 -0800
commit397bff13a761c9b2099fd6f6d0e379d4dae3790c (patch)
treef2e4131cb970ebed714dbf7ed47c5eaa6cf623d4 /etc
parent96a7ddb7604b4f422e2fdff3078e80109efed4dd (diff)
parent0333f968e5d29cf40830f3be66f09fab6ae42ffe (diff)
downloadpfsense-397bff13a761c9b2099fd6f6d0e379d4dae3790c.zip
pfsense-397bff13a761c9b2099fd6f6d0e379d4dae3790c.tar.gz
Merge pull request #436 from phil-davis/master
Add DynDNS No-IP Free account support
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/dyndns.class32
-rw-r--r--etc/inc/services.inc4
2 files changed, 31 insertions, 5 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index 82b8197..82a0e9b 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -97,6 +97,8 @@
var $_dnsRequestIf;
var $_dnsRequestIfIP;
var $_dnsMaxCacheAgeDays;
+ var $_dnsDummyUpdateDone;
+ var $_forceUpdateNeeded;
/*
* Public Constructor Function (added 12 July 05) [beta]
@@ -162,7 +164,9 @@
log_error("DynDNS ({$this->_dnsHost}): running get_failover_interface for {$dnsRequestIf}. found {$this->_dnsRequestIf}");
$this->_dnsRequestIfIP = get_interface_ip($dnsRequestIf);
$this->_dnsMaxCacheAgeDays = 25;
-
+ $this->_dnsDummyUpdateDone = false;
+ $this->_forceUpdateNeeded = $forceUpdate;
+
// Ensure that we were able to lookup the IP
if(!is_ipaddr($this->_dnsIP)) {
log_error("DynDNS ({$this->_dnsHost}) There was an error trying to determine the public IP for interface - {$dnsIf}({$this->_if}). Probably interface is not a WAN interface.");
@@ -182,6 +186,7 @@
case 'dyndns-custom':
case 'dhs':
case 'noip':
+ case 'noip-free':
case 'easydns':
case 'hn':
case 'zoneedit':
@@ -198,7 +203,15 @@
case 'selfhost':
case 'he-net-tunnelbroker':
case 'route53':
- $this->_update();
+ $this->_update();
+ if($this->_dnsDummyUpdateDone == true) {
+ // If a dummy update was needed, then sleep a while and do the update again to put the proper address back.
+ // Some providers (e.g. No-IP free accounts) need to have at least 1 address change every month.
+ // If the address has not changed recently, or the user did "Force Update", then the code does
+ // a dummy address change for providers like this.
+ sleep(10);
+ $this->_update();
+ }
break;
default:
$this->_error(6);
@@ -271,6 +284,7 @@
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
break;
case 'noip':
+ case 'noip-free':
$needsIP = TRUE;
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$server = "http://dynupdate.no-ip.com/ducupdate.php";
@@ -279,7 +293,17 @@
$server = $this->_dnsServer;
if($this->_dnsPort)
$port = ":" . $this->_dnsPort;
- curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost.'&ip=' . $this->_dnsIP);
+ if(($this->_dnsService == "noip-free") &&
+ ($this->_forceUpdateNeeded == true) &&
+ ($this->_dnsDummyUpdateDone == false)) {
+ // Update the IP to a dummy value to force No-IP free accounts to see a change.
+ $iptoset = "192.168.1.1";
+ $this->_dnsDummyUpdateDone = true;
+ log_error("DynDNS ({$this->_dnsHost}): Processing dummy update on No-IP free account. IP temporarily set to " . $iptoset);
+ } else {
+ $iptoset = $this->_dnsIP;
+ }
+ curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost.'&ip=' . $iptoset);
break;
case 'easydns':
$needsIP = TRUE;
@@ -629,6 +653,7 @@
case 'dhs':
break;
case 'noip':
+ case 'noip-free':
list($ip,$code) = explode(":",$data);
switch ($code) {
case 0:
@@ -1061,6 +1086,7 @@
}
if (($currentTime - $cacheTime) > $maxCacheAgeSecs) {
$needs_updating = true;
+ $this->_forceUpdateNeeded = true;
$update_reason = "DynDns: More than " . $this->_dnsMaxCacheAgeDays . " days. Updating. ";
$update_reason .= "{$currentTime} - {$cacheTime} > {$maxCacheAgeSecs} ";
}
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 1cdbf9b..33e2168 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -39,8 +39,8 @@
pfSense_MODULE: utils
*/
-define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-tunnelbroker selfhost route53 custom');
-define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net Tunnelbroker,SelfHost,Route 53,Custom');
+define('DYNDNS_PROVIDER_VALUES', 'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip noip-free ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-tunnelbroker selfhost route53 custom');
+define('DYNDNS_PROVIDER_DESCRIPTIONS', 'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,No-IP (free),ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net Tunnelbroker,SelfHost,Route 53,Custom');
/* implement ipv6 route advertising deamon */
function services_radvd_configure() {
OpenPOWER on IntegriCloud