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:
Lenard Hess 2024-02-03 16:16:39 +01:00
parent ae7f92772b
commit 330ddc6bd2

View file

@ -7178,13 +7178,6 @@ sub nic_porkbun_update {
debug("\nnic_porkbun_update -------------------");
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);
if ($config{$host}{'root-domain'} ne '') {
# Process 'root-domain' option
@ -7197,16 +7190,22 @@ sub nic_porkbun_update {
next;
}
warning("%s has both 'root-domain' and 'on-root-domain' defined. The latter is ignored") if $config{$host}{'on-root-domain'};
}
else {
} elsif ($config{$host}{'on-root-domain'}) {
# Process legacy 'on-root-domain' option
if ($config{$host}{'on-root-domain'}) {
$sub_domain = '';
$domain = $host;
} else {
# Default to the subdomain/domain being split at the first dot
($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);
verbose("UPDATE:","updating %s", $host);