xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired_reply_ttl.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-reply-ttl: 123
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 with reply-ttl
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 right after the TTL expired
21; - check that we get the expired cached answer with the configured TTL
22
23; ns.example.com.
24RANGE_BEGIN 0 100
25	ADDRESS 1.2.3.4
26	ENTRY_BEGIN
27		MATCH opcode qtype qname
28		ADJUST copy_id
29		REPLY QR NOERROR
30		SECTION QUESTION
31			example.com. IN NS
32		SECTION ANSWER
33			example.com. IN NS ns.example.com.
34		SECTION ADDITIONAL
35			ns.example.com. IN A 1.2.3.4
36	ENTRY_END
37
38	ENTRY_BEGIN
39		MATCH opcode qtype qname
40		ADJUST copy_id
41		REPLY QR NOERROR
42		SECTION QUESTION
43			example.com. IN A
44		SECTION ANSWER
45			example.com. 10 IN A 5.6.7.8
46		SECTION AUTHORITY
47			example.com. IN NS ns.example.com.
48		SECTION ADDITIONAL
49			ns.example.com. IN A 1.2.3.4
50	ENTRY_END
51RANGE_END
52
53; Query with RD flag
54STEP 1 QUERY
55ENTRY_BEGIN
56	REPLY RD
57	SECTION QUESTION
58		example.com. IN A
59ENTRY_END
60
61; Check that we got the correct answer (should be cached)
62STEP 10 CHECK_ANSWER
63ENTRY_BEGIN
64	MATCH all ttl
65	REPLY QR RD RA NOERROR
66	SECTION QUESTION
67		example.com. IN A
68	SECTION ANSWER
69		example.com. 10 IN A 5.6.7.8
70	SECTION AUTHORITY
71		example.com. IN NS ns.example.com.
72	SECTION ADDITIONAL
73		ns.example.com. IN A 1.2.3.4
74ENTRY_END
75
76; Wait for the TTL to expire
77STEP 11 TIME_PASSES ELAPSE 3601
78
79; Query again
80STEP 30 QUERY
81ENTRY_BEGIN
82	REPLY RD DO
83	SECTION QUESTION
84		example.com. IN A
85ENTRY_END
86
87; Check that we got a stale answer
88STEP 40 CHECK_ANSWER
89ENTRY_BEGIN
90	MATCH all ttl ede=3
91	REPLY QR RD RA DO NOERROR
92	SECTION QUESTION
93		example.com. IN A
94	SECTION ANSWER
95		example.com.  123 A 5.6.7.8
96	SECTION AUTHORITY
97		example.com. 123 NS ns.example.com.
98	SECTION ADDITIONAL
99		ns.example.com. 123 A 1.2.3.4
100ENTRY_END
101
102; Give time for the pending query to get answered
103STEP 41 TRAFFIC
104
105SCENARIO_END
106