xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired_ttl_client_timeout.rpl (revision d0eba39ba71d0ccd0f91ae4c5ff83442e84710bf)
1; config options
2server:
3	module-config: "validator iterator"
4	qname-minimisation: "no"
5	minimal-responses: no
6	serve-expired: yes
7	serve-expired-ttl: 10
8	serve-expired-client-timeout: 1
9
10stub-zone:
11	name: "example.com"
12	stub-addr: 1.2.3.4
13CONFIG_END
14
15SCENARIO_BEGIN Test serve-expired
16; Scenario overview:
17; - query for example.com. IN A
18; - check that we get an answer for example.com. IN A with the correct TTL
19; - query again right after the TTL expired + serve-expired-ttl
20; - check that we get an updated answer and not the cached one
21
22; ns.example.com.
23RANGE_BEGIN 0 100
24	ADDRESS 1.2.3.4
25	ENTRY_BEGIN
26		MATCH opcode qtype qname
27		ADJUST copy_id
28		REPLY QR NOERROR
29		SECTION QUESTION
30			example.com. IN NS
31		SECTION ANSWER
32			example.com. IN NS ns.example.com.
33		SECTION ADDITIONAL
34			ns.example.com. IN A 1.2.3.4
35	ENTRY_END
36RANGE_END
37
38; ns.example.com.
39RANGE_BEGIN 0 20
40	ADDRESS 1.2.3.4
41	; response to A query
42	ENTRY_BEGIN
43		MATCH opcode qtype qname
44		ADJUST copy_id
45		REPLY QR NOERROR
46		SECTION QUESTION
47			example.com. IN A
48		SECTION ANSWER
49			example.com. IN A 5.6.7.8
50		SECTION AUTHORITY
51			example.com. IN NS ns.example.com.
52		SECTION ADDITIONAL
53			ns.example.com. IN A 1.2.3.4
54	ENTRY_END
55RANGE_END
56
57; Query with RD flag
58STEP 1 QUERY
59ENTRY_BEGIN
60	REPLY RD
61	SECTION QUESTION
62		example.com. IN A
63ENTRY_END
64
65; Check that we got the correct answer (should be cached)
66STEP 10 CHECK_ANSWER
67ENTRY_BEGIN
68	MATCH all ttl
69	REPLY QR RD RA NOERROR
70	SECTION QUESTION
71		example.com. IN A
72	SECTION ANSWER
73		example.com. IN A 5.6.7.8
74	SECTION AUTHORITY
75		example.com. IN NS ns.example.com.
76	SECTION ADDITIONAL
77		ns.example.com. IN A 1.2.3.4
78ENTRY_END
79
80; Wait for the TTL to expire + serve-expired-ttl
81STEP 11 TIME_PASSES ELAPSE 3611
82
83; Query again
84STEP 30 QUERY
85ENTRY_BEGIN
86	REPLY RD
87	SECTION QUESTION
88		example.com. IN A
89ENTRY_END
90
91; Allow the client timer to expire
92STEP 31 TIME_PASSES ELAPSE 1
93
94; We shouldn't get a reply here.
95; There is cached data but serve-expired-ttl has passed.
96
97STEP 40 REPLY
98ENTRY_BEGIN
99	MATCH opcode qtype qname
100	ADJUST copy_id
101	; authoritative answer
102	REPLY QR AA RD RA NOERROR
103	SECTION QUESTION
104		example.com. IN A
105	SECTION ANSWER
106		example.com.  3600 IN A 5.6.7.8
107	SECTION AUTHORITY
108		example.com. 3600 IN NS ns.example.com.
109	SECTION ADDITIONAL
110		ns.example.com. 3600 IN A 1.2.3.4
111ENTRY_END
112
113; Check that we got the updated answer
114STEP 41 CHECK_ANSWER
115ENTRY_BEGIN
116	MATCH all ttl
117	REPLY QR RD RA NOERROR
118	SECTION QUESTION
119		example.com. IN A
120	SECTION ANSWER
121		example.com.  IN A 5.6.7.8
122	SECTION AUTHORITY
123		example.com. IN NS ns.example.com.
124	SECTION ADDITIONAL
125		ns.example.com. IN A 1.2.3.4
126ENTRY_END
127
128SCENARIO_END
129