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