easydns: Update IPv4 and IPv6 separately

https://kb.easydns.com/knowledge/dynamic-dns/ doesn't say anything
about repeating the `myip` parameter, or that both IPv4 and IPv6
addresses can be included in the same `myip` parameter.

Unfortunately it also doesn't say whether updating the IPv4 address
alone will nuke the IPv6 AAAA record, or whether updating the IPv6
address alone will nuke the IPv4 A record (like Google Domains used to
do).  Here's hoping that the A and AAAA records are truly independent.
This commit is contained in:
Richard Hansen 2024-07-20 02:07:27 -04:00
parent 7a4b96e04e
commit da26fe76e0
2 changed files with 38 additions and 40 deletions

View file

@ -124,6 +124,9 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
[#692](https://github.com/ddclient/ddclient/pull/692) [#692](https://github.com/ddclient/ddclient/pull/692)
* `regfishde`: Fixed IPv6 support. * `regfishde`: Fixed IPv6 support.
[#691](https://github.com/ddclient/ddclient/pull/691) [#691](https://github.com/ddclient/ddclient/pull/691)
* `easydns`: IPv4 and IPv6 addresses are now updated separately to be
consistent with the easyDNS documentation.
[#713](https://github.com/ddclient/ddclient/pull/713)
## 2023-11-23 v3.11.2 ## 2023-11-23 v3.11.2

View file

@ -4797,46 +4797,41 @@ sub nic_easydns_update {
'TOOSOON' => 'Update frequency is too short.', 'TOOSOON' => 'Update frequency is too short.',
); );
for my $h (@_) { for my $h (@_) {
my $ipv4 = delete $config{$h}{'wantipv4'}; for my $ipv ('4', '6') {
my $ipv6 = delete $config{$h}{'wantipv6'}; my $ip = delete $config{$h}{"wantipv$ipv"} or next;
info("$h: setting IPv4 address to $ipv4") if $ipv4; info("$h: setting IPv$ipv address to $ip");
info("$h: setting IPv6 address to $ipv6") if $ipv6; #'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON'
#'https://api.cp.easydns.com/dyn/generic.php?hostname=test.burry.ca&myip=10.20.30.40&wildcard=ON' my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip=$ip";
my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip="; $url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF')
$url .= $ipv4 if $ipv4; if defined($config{$h}{'wildcard'});
$url .= "&myip=$_" for $ipv6; $url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO')
$url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF') if $config{$h}{'mx'};
if defined($config{$h}{'wildcard'}); my $reply = geturl(
$url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO') proxy => opt('proxy'),
if $config{$h}{'mx'}; url => $url,
my $reply = geturl( login => $config{$h}{'login'},
proxy => opt('proxy'), password => $config{$h}{'password'},
url => $url, ) // '';
login => $config{$h}{'login'}, if ($reply eq '') {
password => $config{$h}{'password'}, failed("$h: Could not connect to $config{$h}{'server'}");
) // ''; next;
if ($reply eq '') { }
failed("$h: Could not connect to $config{$h}{'server'}"); next if !header_ok($h, $reply);
next; (my $body = $reply) =~ s/^.*?\n\n//s or do {
} failed("$h: Could not connect to $config{$h}{'server'}");
next if !header_ok($h, $reply); next;
(my $body = $reply) =~ s/^.*?\n\n//s or do { };
failed("$h: Could not connect to $config{$h}{'server'}"); my ($status) = $body =~ qr/^(\S*)\b/;
next; $config{$h}{"status-ipv$ipv"} = $status;
}; if ($status eq 'NOERROR') {
my ($status) = $body =~ qr/^(\S*)\b/; $config{$h}{"ipv$ipv"} = $ip;
$config{$h}{'status-ipv4'} = $status if $ipv4; $config{$h}{'mtime'} = $now;
$config{$h}{'status-ipv6'} = $status if $ipv6; success("$h: IPv$ipv address set to $ip");
if ($status eq 'NOERROR') { } elsif (exists $errors{$status}) {
$config{$h}{'ipv4'} = $ipv4; failed("$h: $status: $errors{$status}");
$config{$h}{'ipv6'} = $ipv6; } else {
$config{$h}{'mtime'} = $now; failed("$h: unexpected result: $body");
success("$h: IPv4 address set to $ipv4") if $ipv4; }
success("$h: IPv6 address set to $ipv6") if $ipv6;
} elsif (exists $errors{$status}) {
failed("$h: $status: $errors{$status}");
} else {
failed("$h: unexpected result: $body");
} }
} }
} }