Commit graph

12 commits

Author SHA1 Message Date
Michał Kępień
c5a30a7220
Follow common naming and coding conventions
Make the handlers defined in bin/tests/system/resend_loop/ans3/ans.py
follow canonical naming conventions used in other system tests.  Keep
all server initialization code in the main() function.
2026-05-21 11:52:56 +02:00
Michał Kępień
c3839e830c
Turn _get_cookie() into a method
Since the _get_cookie() function is only used by the CookieHandler
class, make the former a method of the latter to keep related logic
close in the source code.
2026-05-21 11:52:56 +02:00
Michał Kępień
5fa2bd7e53
Tweak the _get_cookie() method
The "len(cookie.server) == 0" condition is superfluous for the
"resend_loop" system test, so remove it.  Add a return type annotation
to the _get_cookie() function.
2026-05-21 11:52:56 +02:00
Michał Kępień
c9ceb191e8
Remove workarounds for dnspython < 2.7.0
dnspython 2.7.0 is now required to run the BIND 9 system test suite.
Drop the workarounds for older dnspython versions as they are now
redundant.
2026-05-21 11:52:56 +02:00
Michał Kępień
de42425bbd
Fix flawed response logic for COOKIE-less queries
The "yield" keyword does not cause a function to return.  By design,
get_responses() may yield multiple DNS responses in a single call.  As
currently implemented, CookieHandler.get_responses() sends two responses
to each client query that does not contain a COOKIE option.  Make the
logic in that method consistent with code comments by only sending one
response to every query - either SERVFAIL or BADCOOKIE, never both.
2026-05-21 11:52:56 +02:00
Michał Kępień
c61539279d
Drop redundant uses of authoritative=True
The ans3 custom server instance is created with default_aa=True.  Do not
pass the authoritative=True keyword argument to the DnsResponseSend
constructor in CookieHandler.get_responses() as it is redundant.
2026-05-21 11:52:56 +02:00
Michał Kępień
802c03313f
Drop unnecessary qctx.prepare_new_response() call
The ans3 custom server does not have any zones defined, so the responses
passed to its handlers by core isctest.asyncserver code are guaranteed
to be empty.  Remove a call to qctx.prepare_new_response() from
CookieHandler.get_responses() as it is redundant.
2026-05-21 11:52:56 +02:00
Michał Kępień
a296bcf587
Remove NoErrorHandler
The NoErrorHandler class does not get matched to any query sent by ns4
in the "resend_loop" test.  Remove it as it is redundant.
2026-05-21 11:52:56 +02:00
Michał Kępień
ba6eee2b80
Simplify match criteria for CookieHandler
The CookieHandler class handles all traffic for the "example." domain.
Make it a subclass of DomainHandler to simplify its definition.
2026-05-21 11:52:56 +02:00
Michał Kępień
c0f01b60fd
Make static response handlers more specific
The RootNSHandler and ExampleNSHandler classes are only equipped to
respond to specific QNAME/QTYPE tuples, not all queries for a specific
QNAME.  Turn them into subclasses of QnameQtypeHandler and make them
only respond to QTYPE=NS queries to prevent sending NS responses for
non-NS queries.
2026-05-21 11:52:56 +02:00
Colin Vidal
47a80bbd87
Update resend_loop_badcookie system test
Update the resend_loop_badcookie system test to ensure there is no
attempt to resend the query using TCP when getting BADCOOKIE from an
upstream server using this transport already.
2026-05-07 13:32:15 +02:00
Matthijs Mekking
9ae83a0e4e
Add reproducer for BADCOOKIE resend loop
Run malicious server: resend_loop/ans3/ans.py

Start BIND: ns4

Send single query to test.example

The resolver will repeatedly resend queries until the fetch timeout
expires, resulting in resulting in thousands of qrysent while the quota
counter remains 0.
2026-05-07 13:32:15 +02:00