Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New implementation of Nameserver11 - #1110 #1034

Merged
merged 6 commits into from
Dec 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#993 - Update Nameserver11 implementation
tgreenx committed Nov 16, 2022
commit ae18ffcb8523abc317e218040ede1bc3aaed8826
35 changes: 11 additions & 24 deletions lib/Zonemaster/Engine/Test/Nameserver.pm
Original file line number Diff line number Diff line change
@@ -359,6 +359,7 @@ Readonly my %TAG_DESCRIPTIONS => (
N10_EDNS_RESPONSE_ERROR => sub {
__x # N10_EDNS_RESPONSE_ERROR
'Expected RCODE but received erroneous response to an EDNS version 1 query. Fetched from the nameservers with IP addresses {ns_ip_list}', @_;
},
NS11_UNKNOWN_OPTION_CODE => sub {
__x # NS11_UNKNOWN_OPTION_CODE
'The DNS response contains an unknown EDNS option-code. Returned from name servers "{ns_ip_list}".', @_;
@@ -1077,44 +1078,30 @@ sub nameserver11 {
my ( $class, $zone ) = @_;
push my @results, info( TEST_CASE_START => { testcase => (split /::/, (caller(0))[3])[-1] } );

my @unknown_opt_code;

# Choose an unassigned EDNS0 Option Codes
# values 15-26945 are Unassigned. Let's say we use 137 ???
my $opt_code = 137;
my $opt_data = q{};
my $opt_length = length($opt_data);
my $rdata = $opt_code*65536 + $opt_length;

my @nss = @{ Zonemaster::Engine::TestMethods->method4and5( $zone ) };

for my $ns ( @nss ) {
foreach my $ns ( @{ Zonemaster::Engine::TestMethods->method4and5( $zone ) } ) {

next if ( _ip_disabled_message( \@results, $ns, q{SOA} ) );

my $p = $ns->query( $zone->name, q{SOA}, { edns_details => { data => $rdata } } );
if ( $p ) {
if ( $p->rcode eq q{FORMERR} and not $p->edns_rcode ) {
push @results, info( NO_EDNS_SUPPORT => { ns => $ns->string } );
}
elsif ( defined $p->edns_data ) {
push @results, info( UNKNOWN_OPTION_CODE => { ns => $ns->string } );
}
elsif ( $p->rcode eq q{NOERROR} and not $p->edns_rcode and $p->edns_version == 0 and not defined $p->edns_data and $p->get_records( q{SOA}, q{answer} ) ) {
next;
}
else {
push @results, info( NS_ERROR => { ns => $ns->string, } );

if ( $p and $p->rcode ne q{FORMERR} ) {
if ( defined $p->edns_data ) {
push @unknown_opt_code, $ns->address->short;
}
}
else {
push @results,
info(
NO_RESPONSE => {
ns => $ns->string,
domain => $zone->name,
}
);
}
}

if ( scalar @unknown_opt_code ){
push @results, info( NS11_UNKNOWN_OPTION_CODE => { ns => join( q{;}, uniq sort @unknown_opt_code ) } );
matsduf marked this conversation as resolved.
Show resolved Hide resolved
}

return ( @results, info( TEST_CASE_END => { testcase => (split /::/, (caller(0))[3])[-1] } ) );