]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unbound/testdata/serve_expired_0ttl_nodata.rpl
unbound: Vendor import 1.18.0
[FreeBSD/FreeBSD.git] / contrib / unbound / testdata / serve_expired_0ttl_nodata.rpl
1 ; config options
2 server:
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
12 stub-zone:
13         name: "example.com"
14         stub-addr: 1.2.3.4
15 CONFIG_END
16
17 SCENARIO_BEGIN Test serve-expired with NXDOMAIN followed by 0 TTL
18 ; Scenario overview:
19 ; - query for 0ttl.example.com. IN A
20 ; - answer from upstream is NODATA; will be cached for the SOA negative TTL.
21 ; - check that the client gets the NODATA; 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.
27 RANGE_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 NOERROR
34                 SECTION QUESTION
35                         0ttl.example.com. IN A
36                 SECTION AUTHORITY
37                         example.com IN SOA ns.example.com dns.example.com 1 7200 3600 2419200 10
38         ENTRY_END
39 RANGE_END
40
41 ; ns.example.com.
42 RANGE_BEGIN 30 100
43         ADDRESS 1.2.3.4
44         ENTRY_BEGIN
45                 MATCH opcode qtype qname
46                 ADJUST copy_id
47                 REPLY QR NOERROR
48                 SECTION QUESTION
49                         example.com. 10 IN NS
50                 SECTION ANSWER
51                         example.com. 10 IN NS ns.example.com.
52                 SECTION ADDITIONAL
53                         ns.example.com. 10 IN A 1.2.3.4
54         ENTRY_END
55
56         ENTRY_BEGIN
57                 MATCH opcode qtype qname
58                 ADJUST copy_id
59                 REPLY QR NOERROR
60                 SECTION QUESTION
61                         0ttl.example.com. IN A
62                 SECTION ANSWER
63                         0ttl.example.com. 0 IN A 5.6.7.8
64                 SECTION AUTHORITY
65                         example.com. 10 IN NS ns.example.com.
66                 SECTION ADDITIONAL
67                         ns.example.com. 10 IN A 1.2.3.4
68         ENTRY_END
69 RANGE_END
70
71 ; Query with RD flag
72 STEP 0 QUERY
73 ENTRY_BEGIN
74         REPLY RD
75         SECTION QUESTION
76                 0ttl.example.com. IN A
77 ENTRY_END
78
79 ; Check that we get the NODATA (will be cached)
80 STEP 10 CHECK_ANSWER
81 ENTRY_BEGIN
82         MATCH all
83         REPLY QR RD RA NOERROR
84         SECTION QUESTION
85                 0ttl.example.com. IN A
86         SECTION AUTHORITY
87                 example.com IN SOA ns.example.com dns.example.com 1 7200 3600 2419200 10
88 ENTRY_END
89
90 ; Query again
91 STEP 20 QUERY
92 ENTRY_BEGIN
93         REPLY RD
94         SECTION QUESTION
95                 0ttl.example.com. IN A
96 ENTRY_END
97
98 ; Check that we get the cached NODATA
99 STEP 30 CHECK_ANSWER
100 ENTRY_BEGIN
101         MATCH all
102         REPLY QR RD RA NOERROR
103         SECTION QUESTION
104                 0ttl.example.com. IN A
105         SECTION AUTHORITY
106                 example.com IN SOA ns.example.com dns.example.com 1 7200 3600 2419200 10
107 ENTRY_END
108
109 ; Wait for the NXDOMAIN to expire
110 STEP 31 TIME_PASSES ELAPSE 32
111
112 ; Query again
113 STEP 40 QUERY
114 ENTRY_BEGIN
115         REPLY RD
116         SECTION QUESTION
117                 0ttl.example.com. IN A
118 ENTRY_END
119
120 ; Check that we get the cached NODATA
121 STEP 50 CHECK_ANSWER
122 ENTRY_BEGIN
123         MATCH all
124         REPLY QR RD RA NOERROR
125         SECTION QUESTION
126                 0ttl.example.com. IN A
127         SECTION AUTHORITY
128                 example.com IN SOA ns.example.com dns.example.com 1 7200 3600 2419200 10
129 ENTRY_END
130
131 ; Query again
132 STEP 60 QUERY
133 ENTRY_BEGIN
134         REPLY RD
135         SECTION QUESTION
136                 0ttl.example.com. IN A
137 ENTRY_END
138
139 ; Check that we got the correct answer
140 STEP 70 CHECK_ANSWER
141 ENTRY_BEGIN
142         MATCH all ttl
143         REPLY QR RD RA NOERROR
144         SECTION QUESTION
145                 0ttl.example.com. IN A
146         SECTION ANSWER
147                 0ttl.example.com. 0 IN A 5.6.7.8
148         SECTION AUTHORITY
149                 example.com. 10 IN NS ns.example.com.
150         SECTION ADDITIONAL
151                 ns.example.com. 10 IN A 1.2.3.4
152 ENTRY_END
153
154 SCENARIO_END