I've had the same error messages in my logs and I think it's related
to the same issue, described below.

This is a rather rare bug which will appear in some cases where a
service provider using the "dyndns2" protocol sends malformed
responses to the client.

When a dynamics DNS service provider issues an status update,
convention is to also echo the clients IP address. ddclient relies on
this behavior, and when the service provider fails to do this, the
cache will not update properly. From my understanding, ddclient will
still properly update the IP, but the cache will be broken and the
service provider will be polled unnecessarily.

The attached patch is a proposed solution to this problem. If the
service provider fails to echo the current IP, the patch simply falls
back to use the IP address which was already gotten using the method
supplied in the users configuration file.

This patch is tested and verified working by myself against ddclient
3.7.3-4.2, which is the latest version in lenny. It will probably need
some work before this fix can be included in the next ddclient
release, but I'll submit it upstream anyway.

Regards,

-- 
Stefan Kangas
--- ddclient    2008-10-17 21:00:51.000000000 +0200
+++ ddclient    2009-08-22 11:37:18.000000000 +0200
@@ -1798,6 +1798,7 @@
 ######################################################################
 ## get_ip
 ######################################################################
+my $stored_ip;
 sub get_ip {
     my $use = lc shift;
     my ($ip, $arg, $reply, $url, $skip) = (undef, opt($use), '');
@@ -1850,6 +1851,14 @@
        $reply = geturl('', $url, opt('fw-login'), opt('fw-password')) || '';
        $arg   = $url;

+    } elsif ($use eq 'store') {
+        if (defined $stored_ip) {
+            $ip = $stored_ip;
+        } else {
+            return get_ip(opt('use'));
+        }
+    }
+
     } else {
        $url  = opt('fw')       || '';
        $skip = opt('fw-skip')  || '';
@@ -1879,6 +1888,7 @@
     }

     debug("get_ip: using %s, %s reports %s", $use, $arg, define($ip, "<undefined>"));
+    $stored_ip = $ip;
     return $ip;
 }

@@ -2325,7 +2335,11 @@

                my ($status, $ip) = split / /, lc $line;
                my $h = shift @hosts;
-
+                ## Some service providers breaks the convention of appending the IP.
+                if (!defined $ip) {
+                    $ip = get_ip('stored');
+                }
+
                $config{$h}{'status'} = $status;
                if ($status eq 'good') {
                    $config{$h}{'ip'}     = $ip;

Reply via email to