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