xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired.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	access-control: 127.0.0.1/32 allow_snoop
8	ede: yes
9	ede-serve-expired: yes
10
11stub-zone:
12	name: "example.com"
13	stub-addr: 1.2.3.4
14CONFIG_END
15
16SCENARIO_BEGIN Test serve-expired
17; Scenario overview:
18; - query for example.com. IN A
19; - check that we get an answer for example.com. IN A with the correct TTL
20; - query again (without the RD bit) right after the TTL expired
21; - check that we get the expired cached answer (this should trigger prefetching)
22; - query with RD bit and check that the cached record was updated
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
38
39	ENTRY_BEGIN
40		MATCH opcode qtype qname
41		ADJUST copy_id
42		REPLY QR NOERROR
43		SECTION QUESTION
44			example.com. IN A
45		SECTION ANSWER
46			example.com. 10 IN A 5.6.7.8
47		SECTION AUTHORITY
48			example.com. IN NS ns.example.com.
49		SECTION ADDITIONAL
50			ns.example.com. IN A 1.2.3.4
51	ENTRY_END
52RANGE_END
53
54; Query with RD flag
55STEP 1 QUERY
56ENTRY_BEGIN
57	REPLY RD
58	SECTION QUESTION
59		example.com. IN A
60ENTRY_END
61
62; Check that we got the correct answer (should be cached)
63STEP 10 CHECK_ANSWER
64ENTRY_BEGIN
65	MATCH all ttl
66	REPLY QR RD RA NOERROR
67	SECTION QUESTION
68		example.com. IN A
69	SECTION ANSWER
70		example.com. 10 IN A 5.6.7.8
71	SECTION AUTHORITY
72		example.com. IN NS ns.example.com.
73	SECTION ADDITIONAL
74		ns.example.com. IN A 1.2.3.4
75ENTRY_END
76
77; Wait for the TTL to expire
78STEP 11 TIME_PASSES ELAPSE 3601
79
80; Query again without RD bit
81STEP 30 QUERY
82ENTRY_BEGIN
83	REPLY DO
84	SECTION QUESTION
85		example.com. IN A
86ENTRY_END
87
88; Check that we got a stale answer
89STEP 40 CHECK_ANSWER
90ENTRY_BEGIN
91	MATCH all ttl ede=3
92	REPLY QR RA DO NOERROR
93	SECTION QUESTION
94		example.com. IN A
95	SECTION ANSWER
96		example.com.  30 IN A 5.6.7.8
97	SECTION AUTHORITY
98		example.com. 30 IN NS ns.example.com.
99	SECTION ADDITIONAL
100		ns.example.com. 30 IN A 1.2.3.4
101ENTRY_END
102
103; Query with RD bit (the record should have been prefetched)
104STEP 50 QUERY
105ENTRY_BEGIN
106	REPLY RD
107	SECTION QUESTION
108		example.com. IN A
109ENTRY_END
110
111STEP 60 CHECK_ANSWER
112ENTRY_BEGIN
113	MATCH all ttl
114	REPLY QR RD RA NOERROR
115	SECTION QUESTION
116		example.com. IN A
117	SECTION ANSWER
118		example.com.  10 IN A 5.6.7.8
119	SECTION AUTHORITY
120		example.com. IN NS ns.example.com.
121	SECTION ADDITIONAL
122		ns.example.com. IN A 1.2.3.4
123ENTRY_END
124
125SCENARIO_END
126