Skip to content

Commit

Permalink
Fix default EDNS behavior
Browse files Browse the repository at this point in the history
This commit fixes queries defaulting as EDNS queries, which was unintended.
Documentation has been updated to reflect the new behavior.
  • Loading branch information
tgreenx committed Nov 19, 2024
1 parent 808889b commit 24fa248
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/Zonemaster/Engine/Nameserver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,13 @@ sub _query {
$flags{q{fallback}} = $href->{q{fallback}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.fallback} );
$flags{q{recurse}} = $href->{q{recurse}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.recurse} );
$flags{q{timeout}} = $href->{q{timeout}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.timeout} );
$flags{q{edns_size}} = $href->{q{edns_size}} // $UDP_EDNS_QUERY_DEFAULT;

if ( $flags{q{dnssec}} ) {
$flags{q{edns_size}} = $href->{q{edns_size}} // $UDP_EDNS_QUERY_DEFAULT;
}
else {
$flags{q{edns_size}} = $href->{q{edns_size}} // 0;
}

if ( exists $href->{edns_details} ) {
$flags{q{dnssec}} = $href->{edns_details}{do} // $flags{q{dnssec}};
Expand Down Expand Up @@ -794,7 +800,7 @@ The retransmission interval.
Set the DO flag in the query. Defaults to false.
If set to true, it becomes an EDNS query.
Value overridden by 'edns_details->do' (if also given). More details in 'edns_details' below.
Value overridden by C<edns_details{do}> (if also given). More details in L<edns_details> below.
=item debug
Expand Down Expand Up @@ -826,10 +832,10 @@ If set to true, prevents a server to be black-listed on a query in case there is
=item edns_size
Set the EDNS0 UDP maximum size. Defaults to 512.
Set the EDNS0 UDP maximum size. Defaults to 0, or 512 if the query is an EDNS query.
Used only when the query is an EDNS query. Does not enable on its own the query to be an EDNS query.
Value overridden by 'edns_details->size' (if also given). More details in 'edns_details' below.
Setting a value other than 0 will also implicitly enable the query to be an EDNS query.
Value overridden by C<edns_details{size}> (if also given). More details in L<edns_details> below.
=item edns_details
Expand All @@ -838,10 +844,10 @@ A hash. An empty hash or a hash with any keys below will enable the query to be
The currently supported keys are 'version', 'z', 'do', 'rcode', 'size' and 'data'.
See L<Zonemaster::LDNS::Packet> for more details (key names prefixed with 'edns_').
Note that flag 'edns_size' also exists (see above) and has the same effect as 'edns_details->size', although the value of the
Note that flag L<edns_size> also exists (see above) and has the same effect as C<edns_details{size}>, although the value of the
latter will take precedence if both are given.
Similarly, note that flag 'dnssec' also exists (see above) and has the same effect as 'edns_details->do', although the value of the
Similarly, note that flag L<dnssec> also exists (see above) and has the same effect as C<edns_details{do}>, although the value of the
latter will take precedence if both are given.
=back
Expand Down

0 comments on commit 24fa248

Please sign in to comment.