File: serve_expired_cached_servfail_refresh.rpl

package info (click to toggle)
unbound 1.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 30,124 kB
  • sloc: ansic: 131,784; sh: 6,810; yacc: 4,119; python: 1,948; makefile: 1,646; awk: 162; perl: 158; xml: 36
file content (145 lines) | stat: -rw-r--r-- 2,931 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
; config options
server:
	module-config: "validator iterator"
	qname-minimisation: "no"
	minimal-responses: no
	serve-expired: yes
	serve-expired-reply-ttl: 123
	log-servfail: yes
	ede: yes
	ede-serve-expired: yes


stub-zone:
	name: "example.com"
	stub-addr: 1.2.3.4
CONFIG_END

SCENARIO_BEGIN Test serve-expired without client-timeout and a SERVFAIL upstream reply
; Scenario overview:
; - query for example.com. IN A
; - answer from upstream is SERVFAIL; will be cached for NORR_TTL(5)
; - check that the client gets the SERVFAIL; also cached
; - query again right after the TTL expired
; - cached SERVFAIL should be ignored and upstream queried
; - answer from upstream is still SERVFAIL; the cached error response will be
;   refreshed for another NORR_TTL(5)
; - check that the client gets the SERVFAIL
; - query again; the upstream now has the answer available
; - check that we get the refreshed cached response instead

; ns.example.com.
RANGE_BEGIN 0 50
	ADDRESS 1.2.3.4
	; response to A query
	ENTRY_BEGIN
		MATCH opcode qtype qname
		ADJUST copy_id
		REPLY QR AA SERVFAIL
		SECTION QUESTION
			example.com. IN A
	ENTRY_END
RANGE_END

; ns.example.com.
RANGE_BEGIN 60 100
	ADDRESS 1.2.3.4
	ENTRY_BEGIN
		MATCH opcode qtype qname
		ADJUST copy_id
		REPLY QR NOERROR
		SECTION QUESTION
			example.com. IN NS
		SECTION ANSWER
			example.com. 10 IN NS ns.example.com.
		SECTION ADDITIONAL
			ns.example.com. 10 IN A 1.2.3.4
	ENTRY_END

	ENTRY_BEGIN
		MATCH opcode qtype qname
		ADJUST copy_id
		REPLY QR NOERROR
		SECTION QUESTION
			example.com. IN A
		SECTION ANSWER
			example.com. 10 IN A 5.6.7.8
		SECTION AUTHORITY
			example.com. 10 IN NS ns.example.com.
		SECTION ADDITIONAL
			ns.example.com. 10 IN A 1.2.3.4
	ENTRY_END
RANGE_END

; Query with RD flag
STEP 0 QUERY
ENTRY_BEGIN
	REPLY RD
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Check that we get the SERVFAIL (will be cached)
STEP 10 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all
	REPLY QR RD RA SERVFAIL
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Query again
STEP 20 QUERY
ENTRY_BEGIN
	REPLY RD
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Check that we get the cached SERVFAIL
STEP 30 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all
	REPLY QR RD RA SERVFAIL
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Wait for the SERVFAIL to expire
STEP 31 TIME_PASSES ELAPSE 6

; Query again
STEP 40 QUERY
ENTRY_BEGIN
	REPLY RD
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Check that we get the SERVFAIL (will be refreshed)
STEP 50 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all
	REPLY QR RD RA SERVFAIL
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Query again, upstream has the real answer available
STEP 60 QUERY
ENTRY_BEGIN
	REPLY RD
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Check that we get the refreshed cached SERVFAIL
STEP 70 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all
	REPLY QR RD RA SERVFAIL
	SECTION QUESTION
		example.com. IN A
ENTRY_END

SCENARIO_END