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)
* `regfishde`: Fixed IPv6 support.
[#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

View file

@ -4797,14 +4797,11 @@ sub nic_easydns_update {
'TOOSOON' => 'Update frequency is too short.',
);
for my $h (@_) {
my $ipv4 = delete $config{$h}{'wantipv4'};
my $ipv6 = delete $config{$h}{'wantipv6'};
info("$h: setting IPv4 address to $ipv4") if $ipv4;
info("$h: setting IPv6 address to $ipv6") if $ipv6;
for my $ipv ('4', '6') {
my $ip = delete $config{$h}{"wantipv$ipv"} or next;
info("$h: setting IPv$ipv address to $ip");
#'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=";
$url .= $ipv4 if $ipv4;
$url .= "&myip=$_" for $ipv6;
my $url = "https://$config{$h}{'server'}$config{$h}{'script'}?hostname=$h&myip=$ip";
$url .= "&wildcard=" . ynu($config{$h}{'wildcard'}, 'ON', 'OFF', 'OFF')
if defined($config{$h}{'wildcard'});
$url .= "&mx=$config{$h}{'mx'}&backmx=" . ynu($config{$h}{'backupmx'}, 'YES', 'NO')
@ -4825,14 +4822,11 @@ sub nic_easydns_update {
next;
};
my ($status) = $body =~ qr/^(\S*)\b/;
$config{$h}{'status-ipv4'} = $status if $ipv4;
$config{$h}{'status-ipv6'} = $status if $ipv6;
$config{$h}{"status-ipv$ipv"} = $status;
if ($status eq 'NOERROR') {
$config{$h}{'ipv4'} = $ipv4;
$config{$h}{'ipv6'} = $ipv6;
$config{$h}{"ipv$ipv"} = $ip;
$config{$h}{'mtime'} = $now;
success("$h: IPv4 address set to $ipv4") if $ipv4;
success("$h: IPv6 address set to $ipv6") if $ipv6;
success("$h: IPv$ipv address set to $ip");
} elsif (exists $errors{$status}) {
failed("$h: $status: $errors{$status}");
} else {
@ -4840,6 +4834,7 @@ sub nic_easydns_update {
}
}
}
}
######################################################################
## nic_namecheap_examples