]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/serve_expired_client_timeout.rpl
Vendor import of Unbound 1.10.1.
[FreeBSD/FreeBSD.git] / testdata / serve_expired_client_timeout.rpl
1 ; config options
2 server:
3         module-config: "validator iterator"
4         qname-minimisation: "no"
5         minimal-responses: no
6         serve-expired: yes
7         serve-expired-client-timeout: 1
8         serve-expired-reply-ttl: 123
9
10 stub-zone:
11         name: "example.com"
12         stub-addr: 1.2.3.4
13 CONFIG_END
14
15 SCENARIO_BEGIN Test serve-expired with client-timeout and reply-ttl
16 ; Scenario overview:
17 ; - query for example.com. IN A
18 ; - check that we get an answer for example.com. IN A with the correct TTL
19 ; - query again right after the TTL expired
20 ; - check that we get the expired cached answer with the configured reply ttl
21
22 ; ns.example.com.
23 RANGE_BEGIN 0 100
24         ADDRESS 1.2.3.4
25         ENTRY_BEGIN
26                 MATCH opcode qtype qname
27                 ADJUST copy_id
28                 REPLY QR NOERROR
29                 SECTION QUESTION
30                         example.com. IN NS
31                 SECTION ANSWER
32                         example.com. IN NS ns.example.com.
33                 SECTION ADDITIONAL
34                         ns.example.com. IN A 1.2.3.4
35         ENTRY_END
36 RANGE_END
37
38 ; ns.example.com.
39 RANGE_BEGIN 0 20
40         ADDRESS 1.2.3.4
41         ; response to A query
42         ENTRY_BEGIN
43                 MATCH opcode qtype qname
44                 ADJUST copy_id
45                 REPLY QR NOERROR
46                 SECTION QUESTION
47                         example.com. IN A
48                 SECTION ANSWER
49                         example.com. 10 IN A 5.6.7.8
50                 SECTION AUTHORITY
51                         example.com. IN NS ns.example.com.
52                 SECTION ADDITIONAL
53                         ns.example.com. IN A 1.2.3.4
54         ENTRY_END
55 RANGE_END
56
57 ; Query with RD flag
58 STEP 1 QUERY
59 ENTRY_BEGIN
60         REPLY RD
61         SECTION QUESTION
62                 example.com. IN A
63 ENTRY_END
64
65 ; Check that we got the correct answer (should be cached)
66 STEP 10 CHECK_ANSWER
67 ENTRY_BEGIN
68         MATCH all ttl
69         REPLY QR RD RA NOERROR
70         SECTION QUESTION
71                 example.com. IN A
72         SECTION ANSWER
73                 example.com. 10 IN A 5.6.7.8
74         SECTION AUTHORITY
75                 example.com. IN NS ns.example.com.
76         SECTION ADDITIONAL
77                 ns.example.com. IN A 1.2.3.4
78 ENTRY_END
79
80 ; Wait for the TTL to expire
81 STEP 11 TIME_PASSES ELAPSE 3600
82
83 ; Query again
84 STEP 30 QUERY
85 ENTRY_BEGIN
86         REPLY RD
87         SECTION QUESTION
88                 example.com. IN A
89 ENTRY_END
90
91 ; Allow the client timer to expire
92 STEP 31 TIME_PASSES ELAPSE 1
93
94 ; Check that we got a stale answer
95 STEP 40 CHECK_ANSWER
96 ENTRY_BEGIN
97         MATCH all ttl
98         REPLY QR RD RA NOERROR
99         SECTION QUESTION
100                 example.com. IN A
101         SECTION ANSWER
102                 example.com.  123 IN A 5.6.7.8
103         SECTION AUTHORITY
104                 example.com. 123 IN NS ns.example.com.
105         SECTION ADDITIONAL
106                 ns.example.com. 123 IN A 1.2.3.4
107 ENTRY_END
108
109 ; Reply to the outstanding query so that the test doesn't fail with
110 ; pending messages.
111 STEP 41 REPLY
112 ENTRY_BEGIN
113         MATCH opcode qtype qname
114         ADJUST copy_id
115         ; authoritative answer
116         REPLY QR AA RD RA NOERROR
117         SECTION QUESTION
118                 example.com. IN A
119         SECTION ANSWER
120                 example.com.  3600 IN A 5.6.7.8
121         SECTION AUTHORITY
122                 example.com. 3600 IN NS ns.example.com.
123         SECTION ADDITIONAL
124                 ns.example.com. 3600 IN A 1.2.3.4
125 ENTRY_END
126
127 SCENARIO_END