1 server: 2 minimal-responses: no 3 iter-scrub-promiscuous: no 4 serve-expired: yes 5 # The value does not matter, we will not simulate delay. 6 # We do not want only serve-expired because fetches from that 7 # apply a generous PREFETCH_LEEWAY. 8 serve-expired-client-timeout: 1000 9 serve-expired-reply-ttl: 123 10 # So that we can only have to give one SERVFAIL answer. 11 outbound-msg-retry: 0 12 ede: yes 13 ede-serve-expired: yes 14 15 forward-zone: name: "." forward-addr: 216.0.0.1 16 CONFIG_END 17 18 SCENARIO_BEGIN RRset from cache updates the message TTL. 19 20 STEP 1 QUERY 21 ENTRY_BEGIN 22 REPLY RD 23 SECTION QUESTION 24 www.example.com. IN A 25 ENTRY_END 26 ; the query is sent to the forwarder - no cache yet. 27 STEP 2 CHECK_OUT_QUERY 28 ENTRY_BEGIN 29 MATCH qname qtype opcode 30 SECTION QUESTION 31 www.example.com. IN A 32 ENTRY_END 33 STEP 3 REPLY 34 ENTRY_BEGIN 35 MATCH opcode qtype qname 36 ADJUST copy_id 37 ; authoritative answer 38 REPLY QR AA RD RA NOERROR 39 SECTION QUESTION 40 www.example.com. IN A 41 SECTION ANSWER 42 www.example.com. 205 IN A 10.20.30.40 43 SECTION AUTHORITY 44 example.com. 210 IN NS ns.example.com. 45 SECTION ADDITIONAL 46 ns.example.com. 210 IN A 10.20.30.50 47 ENTRY_END 48 STEP 4 CHECK_ANSWER 49 ENTRY_BEGIN 50 MATCH all ttl 51 REPLY QR RD RA 52 SECTION QUESTION 53 www.example.com. IN A 54 SECTION ANSWER 55 www.example.com. 205 IN A 10.20.30.40 56 SECTION AUTHORITY 57 example.com. 210 IN NS ns.example.com. 58 SECTION ADDITIONAL 59 ns.example.com. 210 IN A 10.20.30.50 60 ENTRY_END 61 62 ; Wait for the A RRSET to expire. 63 STEP 5 TIME_PASSES ELAPSE 205 64 65 STEP 6 QUERY 66 ENTRY_BEGIN 67 REPLY RD 68 SECTION QUESTION 69 www.example.com. IN A 70 ENTRY_END 71 ; expired answer will not be served due to serve-expired-client-timeout. 72 STEP 7 CHECK_OUT_QUERY 73 ENTRY_BEGIN 74 MATCH qname qtype opcode 75 SECTION QUESTION 76 www.example.com. IN A 77 ENTRY_END 78 STEP 8 REPLY 79 ENTRY_BEGIN 80 MATCH opcode qtype qname 81 ADJUST copy_id 82 ; authoritative answer 83 REPLY QR AA RD RA NOERROR 84 SECTION QUESTION 85 www.example.com. IN A 86 SECTION ANSWER 87 www.example.com. 205 IN A 10.20.30.40 88 SECTION AUTHORITY 89 example.com. 210 IN NS ns.example.com. 90 SECTION ADDITIONAL 91 ns.example.com. 210 IN A 10.20.30.50 92 ENTRY_END 93 ; The cached NS related RRSETs will not be overwritten by the fresh answer. 94 ; The message should have a TTL of 5 instead of 205 from above. 95 STEP 9 CHECK_ANSWER 96 ENTRY_BEGIN 97 MATCH all ttl 98 REPLY QR RD RA 99 SECTION QUESTION 100 www.example.com. IN A 101 SECTION ANSWER 102 www.example.com. 205 IN A 10.20.30.40 103 SECTION AUTHORITY 104 example.com. 5 IN NS ns.example.com. 105 SECTION ADDITIONAL 106 ns.example.com. 5 IN A 10.20.30.50 107 ENTRY_END 108 109 ; Wait for the NS RRSETs to expire. 110 STEP 10 TIME_PASSES ELAPSE 5 111 112 STEP 11 QUERY 113 ENTRY_BEGIN 114 REPLY RD DO 115 SECTION QUESTION 116 www.example.com. IN A 117 ENTRY_END 118 ; The message should be expired, again no expired answer at this point due to 119 ; serve-expired-client-timeout. 120 STEP 12 CHECK_OUT_QUERY 121 ENTRY_BEGIN 122 MATCH qname qtype opcode 123 SECTION QUESTION 124 www.example.com. IN A 125 ENTRY_END 126 STEP 13 REPLY 127 ENTRY_BEGIN 128 MATCH opcode qtype qname 129 ADJUST copy_id 130 REPLY QR RD RA SERVFAIL 131 SECTION QUESTION 132 www.example.com. IN A 133 ENTRY_END 134 ; The SERVFAIL will trigger the serve-expired-client-timeout logic to try and 135 ; replace the SERVFAIL with a possible cached (expired) answer. 136 ; The A RRSET would be at 200 left but the message should have 137 ; been updated to use a TTL of 5 so expired by now. 138 ; If the message TTL was not updated (bug), this message would be treated as 139 ; non-expired and the now expired NS related RRSETs would fail sanity checks 140 ; for non-expired messages. The result would be SERVFAIL here. 141 STEP 14 CHECK_ANSWER 142 ENTRY_BEGIN 143 MATCH all ttl ede=3 144 REPLY QR RD RA DO 145 SECTION QUESTION 146 www.example.com. IN A 147 SECTION ANSWER 148 www.example.com. 200 IN A 10.20.30.40 149 SECTION AUTHORITY 150 example.com. 123 IN NS ns.example.com. 151 SECTION ADDITIONAL 152 ns.example.com. 123 IN A 10.20.30.50 153 ENTRY_END 154 155 SCENARIO_END 156