summaryrefslogtreecommitdiff
path: root/testdata/serve_expired.rpl
blob: 167470335212c4ca623dc4cc8242077612d7d7de (plain) (blame)
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
; config options
server:
	module-config: "validator iterator"
	qname-minimisation: "no"
	minimal-responses: no
	serve-expired: yes
	access-control: 127.0.0.1/32 allow_snoop

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

SCENARIO_BEGIN Test serve-expired
; Scenario overview:
; - query for example.com. IN A
; - check that we get an answer for example.com. IN A with the correct TTL
; - query again (without the RD bit) right after the TTL expired
; - check that we get the expired cached answer (this should trigger prefetching)
; - query with RD bit and check that the cached record was updated

; ns.example.com.
RANGE_BEGIN 0 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. IN NS ns.example.com.
		SECTION ADDITIONAL
			ns.example.com. 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. IN NS ns.example.com.
		SECTION ADDITIONAL
			ns.example.com. IN A 1.2.3.4
	ENTRY_END
RANGE_END

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

; Check that we got the correct answer (should be cached)
STEP 10 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all ttl
	REPLY QR RD RA NOERROR
	SECTION QUESTION
		example.com. IN A
	SECTION ANSWER
		example.com. 10 IN A 5.6.7.8
	SECTION AUTHORITY
		example.com. IN NS ns.example.com.
	SECTION ADDITIONAL
		ns.example.com. IN A 1.2.3.4
ENTRY_END

; Wait for the TTL to expire
STEP 11 TIME_PASSES ELAPSE 3601

; Query again without RD bit
STEP 30 QUERY
ENTRY_BEGIN
	SECTION QUESTION
		example.com. IN A
ENTRY_END

; Check that we got a stale answer
STEP 40 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all ttl
	REPLY QR RA NOERROR
	SECTION QUESTION
		example.com. IN A
	SECTION ANSWER
		example.com.  30 IN A 5.6.7.8
	SECTION AUTHORITY
		example.com. 30 IN NS ns.example.com.
	SECTION ADDITIONAL
		ns.example.com. 30 IN A 1.2.3.4
ENTRY_END

; Query with RD bit (the record should have been prefetched)
STEP 50 QUERY
ENTRY_BEGIN
	REPLY RD
	SECTION QUESTION
		example.com. IN A
ENTRY_END

STEP 60 CHECK_ANSWER
ENTRY_BEGIN
	MATCH all ttl
	REPLY QR RD RA NOERROR
	SECTION QUESTION
		example.com. IN A
	SECTION ANSWER
		example.com.  10 IN A 5.6.7.8
	SECTION AUTHORITY
		example.com. IN NS ns.example.com.
	SECTION ADDITIONAL
		ns.example.com. IN A 1.2.3.4
ENTRY_END

SCENARIO_END