porkbun: Moved subdomain processing out of IPv4/6 loop
The domain/subdomain processing is the same for IPv4 and IPv6, no need to repeat it
This commit is contained in:
parent
ae7f92772b
commit
330ddc6bd2
1 changed files with 22 additions and 23 deletions
19
ddclient.in
19
ddclient.in
|
@ -7178,13 +7178,6 @@ sub nic_porkbun_update {
|
||||||
debug("\nnic_porkbun_update -------------------");
|
debug("\nnic_porkbun_update -------------------");
|
||||||
|
|
||||||
foreach my $host (@_) {
|
foreach my $host (@_) {
|
||||||
foreach my $ipv ('ipv4', 'ipv6') {
|
|
||||||
my $ip = delete $config{$host}{"want$ipv"};
|
|
||||||
if (!$ip) {
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my $rrset_type = is_ipv6($ip) ? "AAAA" : "A";
|
|
||||||
|
|
||||||
my ($sub_domain, $domain);
|
my ($sub_domain, $domain);
|
||||||
if ($config{$host}{'root-domain'} ne '') {
|
if ($config{$host}{'root-domain'} ne '') {
|
||||||
# Process 'root-domain' option
|
# Process 'root-domain' option
|
||||||
|
@ -7197,16 +7190,22 @@ sub nic_porkbun_update {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
warning("%s has both 'root-domain' and 'on-root-domain' defined. The latter is ignored") if $config{$host}{'on-root-domain'};
|
warning("%s has both 'root-domain' and 'on-root-domain' defined. The latter is ignored") if $config{$host}{'on-root-domain'};
|
||||||
}
|
} elsif ($config{$host}{'on-root-domain'}) {
|
||||||
else {
|
|
||||||
# Process legacy 'on-root-domain' option
|
# Process legacy 'on-root-domain' option
|
||||||
if ($config{$host}{'on-root-domain'}) {
|
|
||||||
$sub_domain = '';
|
$sub_domain = '';
|
||||||
$domain = $host;
|
$domain = $host;
|
||||||
} else {
|
} else {
|
||||||
|
# Default to the subdomain/domain being split at the first dot
|
||||||
($sub_domain, $domain) = split(/\./, $host, 2);
|
($sub_domain, $domain) = split(/\./, $host, 2);
|
||||||
}
|
}
|
||||||
|
verbose("subdomain %s, root domain %s", $sub_domain, $domain) if $sub_domain != '';
|
||||||
|
|
||||||
|
foreach my $ipv ('ipv4', 'ipv6') {
|
||||||
|
my $ip = delete $config{$host}{"want$ipv"};
|
||||||
|
if (!$ip) {
|
||||||
|
next;
|
||||||
}
|
}
|
||||||
|
my $rrset_type = is_ipv6($ip) ? "AAAA" : "A";
|
||||||
|
|
||||||
info("setting %s address to %s for %s", $ipv, $ip, $host);
|
info("setting %s address to %s for %s", $ipv, $ip, $host);
|
||||||
verbose("UPDATE:","updating %s", $host);
|
verbose("UPDATE:","updating %s", $host);
|
||||||
|
|
Loading…
Reference in a new issue