From 90de2f9606b4a353d090a6824700c61ebcd84403 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 13 Jul 2024 04:33:44 -0400 Subject: [PATCH] dyndns2: Improve readability of status parsing --- ddclient.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ddclient.in b/ddclient.in index 4f4bcbe..bca675a 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4133,9 +4133,12 @@ sub nic_dyndns2_update { # TODO: The logic below applies the last line's status to all hosts. Change it to apply # each status to its corresponding host. for my $line (@reply) { - # bug #10: some dyndns providers does not return the IP so - # we can't use the returned IP - my ($status, $returnedips) = split / /, lc $line; + # The IP address normally comes after the status, but we ignore it. We could compare + # it with the expected address and mark the update as failed if it differs, but (1) + # some services do not return the IP; and (2) comparison is brittle (e.g., + # 192.000.002.001 vs. 192.0.2.1) and false errors could cause high load on the service + # (an update attempt every min-error-interval instead of every max-interval). + (my $status = $line) =~ s/ .*$//; if ($status eq 'nochg') { warning("updating %s: %s: %s", $hosts, $status, $errors{$status}); $status = 'good';