xref: /netbsd-src/external/bsd/unbound/dist/testdata/serve_expired_zerottl.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 0 TLL with 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 0 TTL
20; - query again; this time the answer has >0 TTL
21; - check the answer
22; - query one last time after expiration
23; - check that the configured reply ttl is used
24
25; ns.example.com.
26RANGE_BEGIN 0 100
27	ADDRESS 1.2.3.4
28	ENTRY_BEGIN
29		MATCH opcode qtype qname
30		ADJUST copy_id
31		REPLY QR NOERROR
32		SECTION QUESTION
33			example.com. IN NS
34		SECTION ANSWER
35			example.com. IN NS ns.example.com.
36		SECTION ADDITIONAL
37			ns.example.com. IN A 1.2.3.4
38	ENTRY_END
39RANGE_END
40
41RANGE_BEGIN 0 10
42	ADDRESS 1.2.3.4
43	ENTRY_BEGIN
44		MATCH opcode qtype qname
45		ADJUST copy_id
46		REPLY QR NOERROR
47		SECTION QUESTION
48			example.com. IN A
49		SECTION ANSWER
50			example.com. 0 IN A 5.6.7.8
51		SECTION AUTHORITY
52			example.com. 0 IN NS ns.example.com.
53		SECTION ADDITIONAL
54			ns.example.com. 0 IN A 1.2.3.4
55	ENTRY_END
56RANGE_END
57
58RANGE_BEGIN 11 100
59	ADDRESS 1.2.3.4
60	ENTRY_BEGIN
61		MATCH opcode qtype qname
62		ADJUST copy_id
63		REPLY QR NOERROR
64		SECTION QUESTION
65			example.com. IN A
66		SECTION ANSWER
67			example.com. 10 IN A 5.6.7.8
68		SECTION AUTHORITY
69			example.com. 10 IN NS ns.example.com.
70		SECTION ADDITIONAL
71			ns.example.com. 10 IN A 1.2.3.4
72	ENTRY_END
73RANGE_END
74
75; Let some time to pass so that timenow > 0
76STEP 1 TIME_PASSES ELAPSE 3600
77
78; Query with RD flag
79STEP 2 QUERY
80ENTRY_BEGIN
81	REPLY RD
82	SECTION QUESTION
83		example.com. IN A
84ENTRY_END
85
86; Check that we got the correct answer with 0 TTL
87STEP 10 CHECK_ANSWER
88ENTRY_BEGIN
89	MATCH all ttl
90	REPLY QR RD RA NOERROR
91	SECTION QUESTION
92		example.com. IN A
93	SECTION ANSWER
94		example.com. 0 IN A 5.6.7.8
95	SECTION AUTHORITY
96		example.com.  0 IN NS ns.example.com.
97	SECTION ADDITIONAL
98		ns.example.com. 0 IN A 1.2.3.4
99ENTRY_END
100
101; Let some time to pass
102STEP 11 TIME_PASSES ELAPSE 1
103
104; Query with RD flag
105STEP 20 QUERY
106ENTRY_BEGIN
107	REPLY RD
108	SECTION QUESTION
109		example.com. IN A
110ENTRY_END
111
112; Check that we got the correct answer
113STEP 29 CHECK_ANSWER
114ENTRY_BEGIN
115	MATCH all ttl
116	REPLY QR RD RA NOERROR
117	SECTION QUESTION
118		example.com. IN A
119	SECTION ANSWER
120		example.com. 10 IN A 5.6.7.8
121	SECTION AUTHORITY
122		example.com. 10 IN NS ns.example.com.
123	SECTION ADDITIONAL
124		ns.example.com. 10 IN A 1.2.3.4
125ENTRY_END
126
127; Wait for the TTL to expire
128STEP 30 TIME_PASSES ELAPSE 11
129
130; Query with RD flag
131STEP 40 QUERY
132ENTRY_BEGIN
133	REPLY RD DO
134	SECTION QUESTION
135		example.com. IN A
136ENTRY_END
137
138; Check that we got the correct answer
139STEP 49 CHECK_ANSWER
140ENTRY_BEGIN
141	MATCH all ttl ede=3
142	REPLY QR RD RA DO NOERROR
143	SECTION QUESTION
144		example.com. IN A
145	SECTION ANSWER
146		example.com. 123 IN A 5.6.7.8
147	SECTION AUTHORITY
148		example.com. 123 IN NS ns.example.com.
149	SECTION ADDITIONAL
150		ns.example.com. 123 IN A 1.2.3.4
151ENTRY_END
152
153; Give time for the pending query to get answered
154STEP 50 TRAFFIC
155
156SCENARIO_END
157