From 6c1f9632fac0782ebc039d511154686e0e1cacb3 Mon Sep 17 00:00:00 2001 From: Lenard Hess Date: Mon, 10 Jul 2023 18:57:02 +0200 Subject: [PATCH] Fixed caching behaviour for new providers with legacy 'use' logic --- ddclient.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ddclient.in b/ddclient.in index 9221a1c..c871b5b 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1337,6 +1337,18 @@ sub update_nics { if (@hosts) { $0 = sprintf("%s - updating %s", $program, join(',', @hosts)); &$update(@hosts); + + # Backwards compatibility: + # If we only have 'use', we set 'wantipv4' or 'wantipv6' depending on the IP type of + # 'wantip'. Newer provider implementations such as cloudflare only check 'wantipv*' + # and set 'status-ipv*' accordingly, ignoring 'wantip' and 'status'. + # For these we then load back the 'status' from 'status-ipv*' to ensure correct + # caching and updating behaviour. + foreach my $h (@hosts) { + $config{$h}{'status'} //= $config{$h}{'status-ipv4'}; + $config{$h}{'status'} //= $config{$h}{'status-ipv6'}; + } + runpostscript(join ' ', keys %ipsv4, keys %ipsv6); } }