]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unbound/testdata/serve_expired_0ttl_servfail.rpl
unbound: Vendor import 1.18.0
[FreeBSD/FreeBSD.git] / contrib / unbound / testdata / serve_expired_0ttl_servfail.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 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.
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 SERVFAIL
34                 SECTION QUESTION
35                         0ttl.example.com. IN A
36         ENTRY_END
37 RANGE_END
38
39 ; ns.example.com.
40 RANGE_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
67 RANGE_END
68
69 ; Query with RD flag
70 STEP 0 QUERY
71 ENTRY_BEGIN
72         REPLY RD
73         SECTION QUESTION
74                 0ttl.example.com. IN A
75 ENTRY_END
76
77 ; Check that we get the SERVFAIL (will be cached)
78 STEP 10 CHECK_ANSWER
79 ENTRY_BEGIN
80         MATCH all
81         REPLY QR RD RA SERVFAIL
82         SECTION QUESTION
83                 0ttl.example.com. IN A
84 ENTRY_END
85
86 ; Query again
87 STEP 20 QUERY
88 ENTRY_BEGIN
89         REPLY RD
90         SECTION QUESTION
91                 0ttl.example.com. IN A
92 ENTRY_END
93
94 ; Check that we get the cached SERVFAIL
95 STEP 30 CHECK_ANSWER
96 ENTRY_BEGIN
97         MATCH all
98         REPLY QR RD RA SERVFAIL
99         SECTION QUESTION
100                 0ttl.example.com. IN A
101 ENTRY_END
102
103 ; Wait for the SERVFAIL to expire
104 STEP 31 TIME_PASSES ELAPSE 32
105
106 ; Query again
107 STEP 40 QUERY
108 ENTRY_BEGIN
109         REPLY RD
110         SECTION QUESTION
111                 0ttl.example.com. IN A
112 ENTRY_END
113
114 ; Check that we got the correct answer
115 STEP 50 CHECK_ANSWER
116 ENTRY_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
127 ENTRY_END
128
129 SCENARIO_END