summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2008-06-10 21:09:52 +0000
committerBill Marquette <billm@pfsense.org>2008-06-10 21:09:52 +0000
commit22de7804926f7969b4e854c272dc5e3b8a811c6b (patch)
treec6ab59f70dd9c076f87efd84bb43450e6884c8b5 /etc
parent566b801b431d8403483511dc9659782582a47375 (diff)
downloadpfsense-22de7804926f7969b4e854c272dc5e3b8a811c6b.zip
pfsense-22de7804926f7969b4e854c272dc5e3b8a811c6b.tar.gz
Detect WAN IP even if behind another NAT device
From: obasi@forums http://forum.pfsense.org/index.php/topic,9794.0.html
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/dyndns.class23
1 files changed, 20 insertions, 3 deletions
diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class
index 24c5521..6303903 100644
--- a/etc/inc/dyndns.class
+++ b/etc/inc/dyndns.class
@@ -28,6 +28,7 @@
* - _error()
* - _detectChange()
* - _debug()
+ * - _checkIP()
* +----------------------------------------------------+
* DynDNS Dynamic - Last Tested: 12 July 2005
* DynDNS Static - Last Tested: NEVER
@@ -679,7 +680,7 @@
if($successful_update == true) {
/* Write WAN IP to cache file */
- $wan_ip = get_current_wan_address();
+ $wan_ip = $this->_checkIP();
$currentTime = time();
log_error("phpDynDNS: updating cache file {$this->_cacheFile}: {$wan_ip}");
conf_mount_rw();
@@ -743,7 +744,7 @@
$currentTime = time();
- $wan_ip = get_current_wan_address();
+ $wan_ip = $this->_checkIP();
$this->_dnsIP = $wan_ip;
log_error("DynDns: Current WAN IP: {$wan_ip}");
@@ -817,7 +818,23 @@
fclose($file);
conf_mount_ro();
}
+ function _checkIP() {
+
+ log_error("DynDns: _checkIP() starting.");
+
+ $ip_ch = curl_init('http://checkip.dyndns.org');
+ curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ $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);
+ $ip_address = trim($matches[1]);
+
+ log_error("DynDns debug information: {$ip_address}");
+
+ return $ip_address;
+ }
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud