Skip to content

Commit 24fa248

Browse files
committed
Fix default EDNS behavior
This commit fixes queries defaulting as EDNS queries, which was unintended. Documentation has been updated to reflect the new behavior.
1 parent 808889b commit 24fa248

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

lib/Zonemaster/Engine/Nameserver.pm

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,13 @@ sub _query {
406406
$flags{q{fallback}} = $href->{q{fallback}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.fallback} );
407407
$flags{q{recurse}} = $href->{q{recurse}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.recurse} );
408408
$flags{q{timeout}} = $href->{q{timeout}} // Zonemaster::Engine::Profile->effective->get( q{resolver.defaults.timeout} );
409-
$flags{q{edns_size}} = $href->{q{edns_size}} // $UDP_EDNS_QUERY_DEFAULT;
409+
410+
if ( $flags{q{dnssec}} ) {
411+
$flags{q{edns_size}} = $href->{q{edns_size}} // $UDP_EDNS_QUERY_DEFAULT;
412+
}
413+
else {
414+
$flags{q{edns_size}} = $href->{q{edns_size}} // 0;
415+
}
410416

411417
if ( exists $href->{edns_details} ) {
412418
$flags{q{dnssec}} = $href->{edns_details}{do} // $flags{q{dnssec}};
@@ -794,7 +800,7 @@ The retransmission interval.
794800
Set the DO flag in the query. Defaults to false.
795801
796802
If set to true, it becomes an EDNS query.
797-
Value overridden by 'edns_details->do' (if also given). More details in 'edns_details' below.
803+
Value overridden by C<edns_details{do}> (if also given). More details in L<edns_details> below.
798804
799805
=item debug
800806
@@ -826,10 +832,10 @@ If set to true, prevents a server to be black-listed on a query in case there is
826832
827833
=item edns_size
828834
829-
Set the EDNS0 UDP maximum size. Defaults to 512.
835+
Set the EDNS0 UDP maximum size. Defaults to 0, or 512 if the query is an EDNS query.
830836
831-
Used only when the query is an EDNS query. Does not enable on its own the query to be an EDNS query.
832-
Value overridden by 'edns_details->size' (if also given). More details in 'edns_details' below.
837+
Setting a value other than 0 will also implicitly enable the query to be an EDNS query.
838+
Value overridden by C<edns_details{size}> (if also given). More details in L<edns_details> below.
833839
834840
=item edns_details
835841
@@ -838,10 +844,10 @@ A hash. An empty hash or a hash with any keys below will enable the query to be
838844
The currently supported keys are 'version', 'z', 'do', 'rcode', 'size' and 'data'.
839845
See L<Zonemaster::LDNS::Packet> for more details (key names prefixed with 'edns_').
840846
841-
Note that flag 'edns_size' also exists (see above) and has the same effect as 'edns_details->size', although the value of the
847+
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
842848
latter will take precedence if both are given.
843849
844-
Similarly, note that flag 'dnssec' also exists (see above) and has the same effect as 'edns_details->do', although the value of the
850+
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
845851
latter will take precedence if both are given.
846852
847853
=back

0 commit comments

Comments
 (0)