Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Dyndns.class update

    Scheduled Pinned Locked Moved Development
    2 Posts 2 Posters 2.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      obasi
      last edited by

      Added his function to get the WAN IP (Internet) regardless of setting.

      
                    /*
      	       * Private Function (added 07 July 08)
                     * - Get the WAN IP
                     */
      		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: (.*)=siU', $ip_result_decoded, $matches);
      			$ip_address = trim($matches[1]);
      
      			log_error("DynDns debug information: {$ip_address}");
      
      			return $ip_address;
      		}
      
      

      Changed the $wan_ip lines in these two functions.

      
      		function _detectChange() {
      
      			log_error("DynDns: _detectChange() starting.");
      
      			$currentTime = time();
      
      			$wan_ip = $this->_checkIP();
      
      
      
      		function _checkStatus($data) {
      			log_error("DynDns: DynDns _checkStatus() starting.");
                              .
                              .
                              .
      			if($successful_update == true) {
      				/* Write WAN IP to cache file */
      				$wan_ip = $this->_checkIP();
      
      

      I hope this helps anyone habing trouble using the dyndns behind a NAT.

      1 Reply Last reply Reply Quote 0
      • B
        billm
        last edited by

        Added to RELENG_1.  Thanks!

        –Bill

        pfSense core developer
        blog - http://www.ucsecurity.com/
        twitter - billmarquette

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.