xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired_client_timeout.rpl (revision 8e33eff89e26cf71871ead62f0d5063e1313c33a)
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 serve-expired with client-timeout and reply-ttl
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 after the TTL expired
22; - check that we get the expired cached answer with the configured reply ttl
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 20
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 1 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 10 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
83STEP 11 TIME_PASSES ELAPSE 3600
84
85; Query again
86STEP 30 QUERY
87ENTRY_BEGIN
88	REPLY RD DO
89	SECTION QUESTION
90		example.com. IN A
91ENTRY_END
92
93; Allow the client timer to expire
94STEP 31 TIME_PASSES ELAPSE 1
95
96; Check that we got a stale answer
97STEP 40 CHECK_ANSWER
98ENTRY_BEGIN
99	MATCH all ttl ede=3
100	REPLY QR RD RA DO NOERROR
101	SECTION QUESTION
102		example.com. IN A
103	SECTION ANSWER
104		example.com.  123 IN A 5.6.7.8
105	SECTION AUTHORITY
106		example.com. 123 IN NS ns.example.com.
107	SECTION ADDITIONAL
108		ns.example.com. 123 IN A 1.2.3.4
109ENTRY_END
110
111; Reply to the outstanding query so that the test doesn't fail with
112; pending messages.
113STEP 41 REPLY
114ENTRY_BEGIN
115	MATCH opcode qtype qname
116	ADJUST copy_id
117	; authoritative answer
118	REPLY QR AA RD RA NOERROR
119	SECTION QUESTION
120		example.com. IN A
121	SECTION ANSWER
122		example.com.  3600 IN A 5.6.7.8
123	SECTION AUTHORITY
124		example.com. 3600 IN NS ns.example.com.
125	SECTION ADDITIONAL
126		ns.example.com. 3600 IN A 1.2.3.4
127ENTRY_END
128
129SCENARIO_END
130