domeneshop: Add IPv6 support

This commit is contained in:
Richard Hansen 2024-07-19 18:47:48 -04:00
parent 61fff1c344
commit ef8bf634fe
2 changed files with 20 additions and 16 deletions

View file

@ -84,6 +84,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
records. [#695](https://github.com/ddclient/ddclient/pull/695) records. [#695](https://github.com/ddclient/ddclient/pull/695)
* `inwx`: New `protocol` option for updating [INWX](https://www.inwx.com/) * `inwx`: New `protocol` option for updating [INWX](https://www.inwx.com/)
records. [#690](https://github.com/ddclient/ddclient/pull/690) records. [#690](https://github.com/ddclient/ddclient/pull/690)
* `domeneshop`: Add IPv6 support.
[#719](https://github.com/ddclient/ddclient/pull/719)
### Bug fixes ### Bug fixes

View file

@ -4314,23 +4314,25 @@ EoEXAMPLE
sub nic_domeneshop_update { sub nic_domeneshop_update {
debug("\nnic_domeneshop_update -------------------"); debug("\nnic_domeneshop_update -------------------");
for my $h (@_) { for my $h (@_) {
my $ip = delete $config{$h}{'wantip'}; for my $ipv ('4', '6') {
info("$h: Setting IP address to $ip"); my $ip = delete $config{$h}{"wantipv$ipv"} or next;
my $reply = geturl( info("$h: Setting IPv$ipv address to $ip");
proxy => opt('proxy'), my $reply = geturl(
url => "$config{$h}{'server'}/v0/dyndns/update?hostname=$h&myip=$ip", proxy => opt('proxy'),
login => $config{$h}{'login'}, url => "$config{$h}{'server'}/v0/dyndns/update?hostname=$h&myip=$ip",
password => $config{$h}{'password'}, login => $config{$h}{'login'},
); password => $config{$h}{'password'},
if (!defined($reply) || !$reply) { );
failed("$h: Request to $config{$h}{'server'} failed"); if (!defined($reply) || !$reply) {
next; failed("$h: Request to $config{$h}{'server'} failed");
next;
}
next if !header_ok($h, $reply);
$config{$h}{"ipv$ipv"} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{"status-ipv$ipv"} = 'good';
success("$h: IPv$ipv address set to $ip");
} }
next if !header_ok($h, $reply);
$config{$h}{'ip'} = $ip;
$config{$h}{'mtime'} = $now;
$config{$h}{'status'} = 'good';
success("$h: IP address set to $ip");
} }
} }