| 1 | package Net::DNS::ErrorReporter; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: a DNS Error Reporting (RFC 9567) agent. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Net::DNS; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | # see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#extended-dns-error-codes | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | OTHER_ERROR => 0, | |||||||||||||||||||||||||||||||||||||||||
| 8 | UNSUPPORTED_DNSKEY_ALGORITHM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 9 | UNSUPPORTED_DS_DIGEST_TYPE => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 10 | STALE_ANSWER => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 11 | FORGED_ANSWER => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 12 | DNSSEC_INDETERMINATE => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | DNSSEC_BOGUS => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | SIGNATURE_EXPIRED => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | SIGNATURE_NOT_YET_VALID => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 16 | DNSKEY_MISSING => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | RRSIGS_MISSING => 10, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | NO_ZONE_KEY_BIT_SET => 11, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | NSEC_MISSING => 12, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | CACHED_ERROR => 13, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | NOT_READY => 14, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | BLOCKED => 15, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | CENSORED => 16, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | FILTERED => 17, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | PROHIBITED => 18, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | STALE_NXDOMAIN_ANSWER => 19, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | NOT_AUTHORITATIVE => 20, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | NOT_SUPPORTED => 21, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | NO_REACHABLE_AUTHORITY => 22, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | NETWORK_ERROR => 23, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | INVALID_DATA => 24, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | SIGNATURE_EXPIRED_BEFORE_VALID => 25, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | TOO_EARLY => 26, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | UNSUPPORTED_NSEC3_ITERATIONS_VALUE => 27, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | UNABLE_TO_CONFORM_TO_POLICY => 28, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | SYNTHESIZED => 29, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | INVALID_QUERY_TYPE => 30, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | RATE_LIMITED => 31, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | OVER_QUOTA => 32, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | NEGATIVE_TRUST_ANCHOR => 33, | ||||||||||||||||||||||||||||||||||||||||||
| 41 | NEW_DELEGATION_ONLY => 34, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | use common::sense; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | my $self = bless({}, shift); | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 1 | $self->{resolver} = Net::DNS::Resolver->new( | |||||||||||||||||||||||||||||||||||||||||
| 53 | persistent_tcp => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | retry => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub report { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my $packet = {@_}->{packet}; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $error = {@_}->{error}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | return unless (defined($error) && defined($packet) && defined($packet->edns)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $error and defined $packet and defined $packet->edns
defined $error and defined $packet
MC/DC0%0/3
defined $error and defined $packet and defined $packet->edns
defined $error
defined $packet
defined $packet->edns
Truth table0%0/4
A and B and C
A= defined $errorB= defined $packetC= defined $packet->edns
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my ($structure) = $packet->edns->option(q{REPORT-CHANNEL}); | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | return unless (defined($structure) && exists $structure->{q{REPORT-CHANNEL}}->{q{AGENT-DOMAIN}}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $structure and exists $structure->{"REPORT-CHANNEL"}{"AGENT-DOMAIN"}
MC/DC0%0/2
defined $structure and exists $structure->{"REPORT-CHANNEL"}{"AGENT-DOMAIN"}
defined $structure
exists $structure->{"REPORT-CHANNEL"}{"AGENT-DOMAIN"}
Truth table0%0/3
A and B
A= defined $structureB= exists $structure->{"REPORT-CHANNEL"}{"AGENT-DOMAIN"}
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my @labels = grep { length > 0 } Net::DNS::Domain->new(($packet->question)[0]->name)->label; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | return unless (scalar(@labels) > 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | unshift(@labels, ($packet->question)[0]->type); | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | unshift(@labels, q{_er}); | |||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | push(@labels, sprintf(q{%u}, $error)); | |||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | push(@labels, q{_er}); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | push(@labels, Net::DNS::Domain->new($structure->{q{REPORT-CHANNEL}}->{q{AGENT-DOMAIN}})->label); | |||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return $self->resolver->send(join(q{.}, @labels), q{TXT}); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub resolver { shift->{resolver} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolver: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | __END__ | ||||||||||||||||||||||||||||||||||||||||||