easydns, porkbun: Set status-ipv4 and status-ipv6 instead of status
This fixes caching issues when using the 'usev4' or 'usev6' parameters. Without this, the "min-interval" and "warned-min-interval" limits will not work. For the legacy 'use' parameter, the wrapping code takes care of translating 'status-ipv*' to 'status'.
This commit is contained in:
parent
17fd6ec083
commit
7869acb266
1 changed files with 16 additions and 15 deletions
31
ddclient.in
31
ddclient.in
|
@ -4747,7 +4747,8 @@ sub nic_easydns_update {
|
||||||
my ($status) = $line =~ /^(\S*)\b.*/;
|
my ($status) = $line =~ /^(\S*)\b.*/;
|
||||||
my $h = shift @hosts;
|
my $h = shift @hosts;
|
||||||
|
|
||||||
$config{$h}{'status'} = $status;
|
$config{$h}{'status-ipv4'} = $status if $ipv4;
|
||||||
|
$config{$h}{'status-ipv6'} = $status if $ipv6;
|
||||||
if ($status eq 'NOERROR') {
|
if ($status eq 'NOERROR') {
|
||||||
$config{$h}{'ipv4'} = $ipv4;
|
$config{$h}{'ipv4'} = $ipv4;
|
||||||
$config{$h}{'ipv6'} = $ipv6;
|
$config{$h}{'ipv6'} = $ipv6;
|
||||||
|
@ -7081,12 +7082,12 @@ sub nic_porkbun_update {
|
||||||
);
|
);
|
||||||
# No response, declare as failed
|
# No response, declare as failed
|
||||||
if (!defined($reply) || !$reply) {
|
if (!defined($reply) || !$reply) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv4'} = "bad";
|
||||||
failed("updating %s: Could not connect to porkbun.com.", $host);
|
failed("updating %s: Could not connect to porkbun.com.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (!header_ok($host, $reply)) {
|
if (!header_ok($host, $reply)) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv4'} = "bad";
|
||||||
failed("updating %s: failed (%s)", $host, $reply);
|
failed("updating %s: failed (%s)", $host, $reply);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7095,12 +7096,12 @@ sub nic_porkbun_update {
|
||||||
$reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
|
$reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
|
||||||
my $response = eval { decode_json(${^MATCH}) };
|
my $response = eval { decode_json(${^MATCH}) };
|
||||||
if (!defined($response)) {
|
if (!defined($response)) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv4'} = "bad";
|
||||||
failed("%s -- Unexpected service response.", $host);
|
failed("%s -- Unexpected service response.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($response->{status} ne 'SUCCESS') {
|
if ($response->{status} ne 'SUCCESS') {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv4'} = "bad";
|
||||||
failed("%s -- Unexpected status. (status = %s)", $host, $response->{status});
|
failed("%s -- Unexpected status. (status = %s)", $host, $response->{status});
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7112,7 +7113,7 @@ sub nic_porkbun_update {
|
||||||
}
|
}
|
||||||
my $current_content = $records->[0]->{'content'};
|
my $current_content = $records->[0]->{'content'};
|
||||||
if ($current_content eq $ipv4) {
|
if ($current_content eq $ipv4) {
|
||||||
$config{$host}{'status'} = "good";
|
$config{$host}{'status-ipv4'} = "good";
|
||||||
success("updating %s: skipped: IPv4 address was already set to %s.", $host, $ipv4);
|
success("updating %s: skipped: IPv4 address was already set to %s.", $host, $ipv4);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7144,11 +7145,11 @@ sub nic_porkbun_update {
|
||||||
failed("updating %s: failed (%s)", $host, $reply);
|
failed("updating %s: failed (%s)", $host, $reply);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$config{$host}{'status'} = "good";
|
$config{$host}{'status-ipv4'} = "good";
|
||||||
success("updating %s: good: IPv4 address set to %s", $host, $ipv4);
|
success("updating %s: good: IPv4 address set to %s", $host, $ipv4);
|
||||||
next;
|
next;
|
||||||
} else {
|
} else {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv4'} = "bad";
|
||||||
failed("updating %s: No applicable existing records.", $host);
|
failed("updating %s: No applicable existing records.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7174,12 +7175,12 @@ sub nic_porkbun_update {
|
||||||
);
|
);
|
||||||
# No response, declare as failed
|
# No response, declare as failed
|
||||||
if (!defined($reply) || !$reply) {
|
if (!defined($reply) || !$reply) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv6'} = "bad";
|
||||||
failed("updating %s: Could not connect to porkbun.com.", $host);
|
failed("updating %s: Could not connect to porkbun.com.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (!header_ok($host, $reply)) {
|
if (!header_ok($host, $reply)) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv6'} = "bad";
|
||||||
failed("updating %s: failed (%s)", $host, $reply);
|
failed("updating %s: failed (%s)", $host, $reply);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7188,12 +7189,12 @@ sub nic_porkbun_update {
|
||||||
$reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
|
$reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
|
||||||
my $response = eval { decode_json(${^MATCH}) };
|
my $response = eval { decode_json(${^MATCH}) };
|
||||||
if (!defined($response)) {
|
if (!defined($response)) {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv6'} = "bad";
|
||||||
failed("%s -- Unexpected service response.", $host);
|
failed("%s -- Unexpected service response.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ($response->{status} ne 'SUCCESS') {
|
if ($response->{status} ne 'SUCCESS') {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv6'} = "bad";
|
||||||
failed("%s -- Unexpected status. (status = %s)", $host, $response->{status});
|
failed("%s -- Unexpected status. (status = %s)", $host, $response->{status});
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7205,7 +7206,7 @@ sub nic_porkbun_update {
|
||||||
}
|
}
|
||||||
my $current_content = $records->[0]->{'content'};
|
my $current_content = $records->[0]->{'content'};
|
||||||
if ($current_content eq $ipv6) {
|
if ($current_content eq $ipv6) {
|
||||||
$config{$host}{'status'} = "good";
|
$config{$host}{'status-ipv6'} = "good";
|
||||||
success("updating %s: skipped: IPv6 address was already set to %s.", $host, $ipv6);
|
success("updating %s: skipped: IPv6 address was already set to %s.", $host, $ipv6);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7237,11 +7238,11 @@ sub nic_porkbun_update {
|
||||||
failed("updating %s: failed (%s)", $host, $reply);
|
failed("updating %s: failed (%s)", $host, $reply);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
$config{$host}{'status'} = "good";
|
$config{$host}{'status-ipv6'} = "good";
|
||||||
success("updating %s: good: IPv6 address set to %s", $host, $ipv4);
|
success("updating %s: good: IPv6 address set to %s", $host, $ipv4);
|
||||||
next;
|
next;
|
||||||
} else {
|
} else {
|
||||||
$config{$host}{'status'} = "bad";
|
$config{$host}{'status-ipv6'} = "bad";
|
||||||
failed("updating %s: No applicable existing records.", $host);
|
failed("updating %s: No applicable existing records.", $host);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue