xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired_client_timeout_no_prefetch.rpl (revision 7a540f2bd4f5b968566c2607d6462c7f2fb452cf)
1; config options
2server:
3	module-config: "validator iterator"
4	qname-minimisation: "no"
5	minimal-responses: no
6	serve-expired: yes
7	serve-expired-client-timeout: 1
8	serve-expired-reply-ttl: 123
9	ede: yes
10	ede-serve-expired: yes
11
12stub-zone:
13	name: "example.com"
14	stub-addr: 1.2.3.4
15CONFIG_END
16
17SCENARIO_BEGIN Test that no prefetch is triggered for 0TTL records with serve-expired and client-timeout enabled
18; Scenario overview:
19; - query for example.com. IN A
20; - check that we get an answer for example.com. IN A with the correct TTL
21; - query again right at the 0TTL cached entry
22; - check that we get the cached answer with no prefetching triggered
23
24; ns.example.com.
25RANGE_BEGIN 0 100
26	ADDRESS 1.2.3.4
27	ENTRY_BEGIN
28		MATCH opcode qtype qname
29		ADJUST copy_id
30		REPLY QR NOERROR
31		SECTION QUESTION
32			example.com. IN NS
33		SECTION ANSWER
34			example.com. IN NS ns.example.com.
35		SECTION ADDITIONAL
36			ns.example.com. IN A 1.2.3.4
37	ENTRY_END
38RANGE_END
39
40; ns.example.com.
41RANGE_BEGIN 0 10
42	ADDRESS 1.2.3.4
43	; response to A query
44	ENTRY_BEGIN
45		MATCH opcode qtype qname
46		ADJUST copy_id
47		REPLY QR NOERROR
48		SECTION QUESTION
49			example.com. IN A
50		SECTION ANSWER
51			example.com. 10 IN A 5.6.7.8
52		SECTION AUTHORITY
53			example.com. IN NS ns.example.com.
54		SECTION ADDITIONAL
55			ns.example.com. IN A 1.2.3.4
56	ENTRY_END
57RANGE_END
58
59; Query with RD flag
60STEP 0 QUERY
61ENTRY_BEGIN
62	REPLY RD
63	SECTION QUESTION
64		example.com. IN A
65ENTRY_END
66
67; Check that we got the correct answer (should be cached)
68STEP 1 CHECK_ANSWER
69ENTRY_BEGIN
70	MATCH all ttl
71	REPLY QR RD RA NOERROR
72	SECTION QUESTION
73		example.com. IN A
74	SECTION ANSWER
75		example.com. 10 IN A 5.6.7.8
76	SECTION AUTHORITY
77		example.com. IN NS ns.example.com.
78	SECTION ADDITIONAL
79		ns.example.com. IN A 1.2.3.4
80ENTRY_END
81
82; Wait for the TTL to expire and produce a 0 TTL cached record.
83STEP 10 TIME_PASSES ELAPSE 10
84
85; Query again
86STEP 20 QUERY
87ENTRY_BEGIN
88	REPLY RD DO
89	SECTION QUESTION
90		example.com. IN A
91ENTRY_END
92
93; This should come from the cache with no prefetch triggered (earlier bug).
94STEP 21 CHECK_ANSWER
95ENTRY_BEGIN
96	MATCH all ttl
97	REPLY QR RD RA DO NOERROR
98	SECTION QUESTION
99		example.com. IN A
100	SECTION ANSWER
101		example.com.  0 IN A 5.6.7.8
102	SECTION AUTHORITY
103		example.com. 3590 IN NS ns.example.com.
104	SECTION ADDITIONAL
105		ns.example.com. 3590 IN A 1.2.3.4
106ENTRY_END
107
108; If a prefetch triggers the test will fail with 'messages pending'.
109
110SCENARIO_END
111