fix nsupdate using wrong type for ipv6 addresses

This commit is contained in:
Michael Harder 2016-02-04 01:06:17 -08:00
parent 1ec1b291ba
commit 62c6460784

View file

@ -24,6 +24,7 @@ use strict;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
use IO::Socket; use IO::Socket;
use Data::Validate::IP;
my $version = "3.8.3"; my $version = "3.8.3";
my $programd = $0; my $programd = $0;
@ -4132,6 +4133,12 @@ sub nic_nsupdate_update {
my $server = $config{$h}{'server'}; my $server = $config{$h}{'server'};
my $zone = $config{$h}{'zone'}; my $zone = $config{$h}{'zone'};
my $ip = $config{$h}{'wantip'}; my $ip = $config{$h}{'wantip'};
my $recordtype = '';
if (is_ipv6($ip)) {
$recordtype = 'AAAA';
} else {
$recordtype = 'A';
}
delete $config{$_}{'wantip'} foreach @hosts; delete $config{$_}{'wantip'} foreach @hosts;
info("setting IP address to %s for %s", $ip, $hosts); info("setting IP address to %s for %s", $ip, $hosts);
@ -4144,8 +4151,8 @@ zone $zone.
EoINSTR1 EoINSTR1
foreach (@hosts) { foreach (@hosts) {
$instructions .= <<EoINSTR2; $instructions .= <<EoINSTR2;
update delete $_. A update delete $_. $recordtype
update add $_. $config{$_}{'ttl'} A $ip update add $_. $config{$_}{'ttl'} $recordtype $ip
EoINSTR2 EoINSTR2
} }
$instructions .= <<EoINSTR3; $instructions .= <<EoINSTR3;