Skip to content

Commit

Permalink
fix nsupdate using wrong type for ipv6 addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHarder committed Feb 4, 2016
1 parent 1ec1b29 commit 62c6460
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ddclient
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use strict;
use Getopt::Long;
use Sys::Hostname;
use IO::Socket;
use Data::Validate::IP;

my $version = "3.8.3";
my $programd = $0;
Expand Down Expand Up @@ -4132,6 +4133,12 @@ sub nic_nsupdate_update {
my $server = $config{$h}{'server'};
my $zone = $config{$h}{'zone'};
my $ip = $config{$h}{'wantip'};
my $recordtype = '';
if (is_ipv6($ip)) {
$recordtype = 'AAAA';
} else {
$recordtype = 'A';
}
delete $config{$_}{'wantip'} foreach @hosts;

info("setting IP address to %s for %s", $ip, $hosts);
Expand All @@ -4144,8 +4151,8 @@ zone $zone.
EoINSTR1
foreach (@hosts) {
$instructions .= <<EoINSTR2;
update delete $_. A
update add $_. $config{$_}{'ttl'} A $ip
update delete $_. $recordtype
update add $_. $config{$_}{'ttl'} $recordtype $ip
EoINSTR2
}
$instructions .= <<EoINSTR3;
Expand Down

0 comments on commit 62c6460

Please sign in to comment.