BUG in 2.4.1 - DynDNS wildcard settings not working as it should



  • The pfsense Dynamic DNS service does not work correctly with Loopia DynDNS. Looking into the problem it seems other DynDNS providers could be affected too since the single line of code that is misbehaving is used in many places.

    Looking at the dynDNS code in /etc/inc/dyndns.class, the original untouched code below does not work with Loopia even if the wildcard setting is checked on the pfsense dyndns settings page. The original code will update the IP okay but remove the CNAME totally in the DNS settings at Loopia. When CNAME is removed from the domain DNS settings the 'www.domain.com' address will stop working, only 'domain.com' will work until CNAME is restored in Loopias DNS settings.

    case 'loopia':
    	$needsIP = TRUE;
    	if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
    	curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
    	curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard );
    	break;
    

    This tweaked test code below works perfectly with Loopia. IP updates correctly and CNAME in the DNS settings at Loopia is kept untouched:

    case 'loopia':
    	$needsIP = TRUE;
    	$this->_dnsWildcard = "ON";
    	curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
    	curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard );
    	break;
    

    As you can see the only difference is that I force the variable "$this->_dnsWildcard" to "ON". This means that the original line of code:

    if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
    

    simply just isn't setting the variable to "ON" as it should when the checkbox on the settings page is checked. Why is this single line of code not working? Well I don't know what the variable contains when it is tested with if and isset. But it's either not set at all even though the checkbox is or it is set to "OFF" by default somewhere earlier in the code.

    This problem has been around since… ever. Mentioned before here http://forum.pfsense.org/index.php/topic,67793.msg375153.html#msg375153







  • Hi

    I also noticed that problem with DynDNS for Loopia a while ago, so I made this fix on my own pfSense box:

    
    case 'loopia':
    	$needsIP = TRUE;
    	if(isset($this->_dnsWildcard) && $this->_dnsWildcard == TRUE) {
    		$this->_dnsWildcard = "ON";
    	}
    	else {
    		$this->_dnsWildcard = "OFF";
    	}
    	curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
    	curl_setopt($ch, CURLOPT_URL, 'https://dyndns.loopia.se/?system=custom&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
    	break;
    
    

    I agree that the issue with isset($this->_dnsWildcard) could affect other providers too.
    So maybe my fix needs to be adjusted, if the behaviour of isset($this->_dnsWildcard) changes.

    I've also changed the host to dyndns.loopia.se, since that's what their support page says (in Swedish):
    https://support.loopia.se/wiki/om-dyndns-stodet/

    Btw, it would be nice if this change can be included in future versions of pfSense? :)



  • @Coffeemaker:

    I agree that the issue with isset($this->_dnsWildcard) could affect other providers too.

    Yes it quite sure does. The DynDNS code really needs a quick overhaul.

    @Coffeemaker:

    Btw, it would be nice if this change can be included in future versions of pfSense? :)

    YES! Since more DynDNS providers clearly are affected this really needs to be addressed since it's not only a verified bug, the fix is done too (although a bit of work needs to be done to copy the working code into the other providers too). How does one go about to make sure it's added to the main development thread? Sorry for my ignorance but where do you report proper pfsense bugs?



  • I reported the bug here:
    https://redmine.pfsense.org/issues/8014



  • @Coffeemaker:

    I reported the bug here:
    https://redmine.pfsense.org/issues/8014

    Kanon!

    :D



  • @Coffeemaker:

    I reported the bug here:
    https://redmine.pfsense.org/issues/8014

    Based on recent info from Loopia Support, the recommended API to use is not https://dyndns.loopia.se but https://api.loopia.se/. One important advantage is that you then also can create a separate User for the DNS update and doesn't need to use your admin login for the Loopia Customer Zone.

    But are there any specific reason why you want to use the old API?

    https://translate.google.se/translate?hl=sv&sl=sv&tl=en&u=https%3A%2F%2Fsupport.loopia.se%2Fwiki%2Fuppdatera-dynamisk-ip-adress-med-loopiaapi%2F&sandbox=1



  • @Videonisse:

    Based on recent info from Loopia Support, the recommended API to use is not https://dyndns.loopia.se but https://api.loopia.se/. One important advantage is that you then also can create a separate User for the DNS update and doesn't need to use your admin login for the Loopia Customer Zone.

    But are there any specific reason why you want to use the old API?

    https://translate.google.se/translate?hl=sv&sl=sv&tl=en&u=https%3A%2F%2Fsupport.loopia.se%2Fwiki%2Fuppdatera-dynamisk-ip-adress-med-loopiaapi%2F&sandbox=1

    I'd much rather use the new API of course. But… how would I do that?

    Anyhow, I've switched to OPNsense so it doesn't matter for me anymore.


Log in to reply