]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Test and fix.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 13 Mar 2018 13:14:56 +0000 (13:14 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 13 Mar 2018 13:14:56 +0000 (13:14 +0000)
git-svn-id: file:///svn/unbound/trunk@4583 be551aaa-1e26-0410-a405-d3ace91eadb9

services/cache/dns.c
testdata/fwd_0ttlservfail.rpl [new file with mode: 0644]

index 382b3296215ade950a381af7f232076d77a146d1..35adc35b57ee515eacc269e931e5720a915099ea 100644 (file)
@@ -135,7 +135,7 @@ msg_del_servfail(struct module_env* env, struct query_info* qinfo,
         * lookups move from the cacheresponse stage to the recursionresponse
         * stage */
        e = msg_cache_lookup(env, qinfo->qname, qinfo->qname_len,
-               qinfo->qtype, qinfo->qclass, flags, *env->now, 0);
+               qinfo->qtype, qinfo->qclass, flags, 0, 0);
        if(!e) return;
        /* we don't check for the ttl here, also expired servfail entries
         * are removed.  If the user uses serve-expired, they would still be
diff --git a/testdata/fwd_0ttlservfail.rpl b/testdata/fwd_0ttlservfail.rpl
new file mode 100644 (file)
index 0000000..f1a6dc6
--- /dev/null
@@ -0,0 +1,85 @@
+; This is a comment.
+; config options go here.
+server:
+       serve-expired: yes
+forward-zone: name: "." forward-addr: 216.0.0.1
+CONFIG_END
+
+SCENARIO_BEGIN Zero ttl answer needs to override servfail in cache.
+RANGE_BEGIN 0 100
+       ENTRY_BEGIN
+       MATCH opcode qtype qname
+       ADJUST copy_id
+       REPLY QR RD RA SERVFAIL
+       SECTION QUESTION
+www.example.com. IN A
+       SECTION ANSWER
+       ENTRY_END
+RANGE_END
+RANGE_BEGIN 200 300
+       ENTRY_BEGIN
+       MATCH opcode qtype qname
+       ADJUST copy_id
+       REPLY QR RD RA NOERROR
+       SECTION QUESTION
+www.example.com. IN A
+       SECTION ANSWER
+www.example.com. 0 IN A 10.20.30.40
+       ENTRY_END
+RANGE_END
+
+STEP 1 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+STEP 10 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA SERVFAIL
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+ENTRY_END
+
+; enough to pass by the TTL of the servfail answer in cache
+STEP 50 TIME_PASSES ELAPSE 40
+
+; this query triggers a prefetch
+STEP 210 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+STEP 220 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA SERVFAIL
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+ENTRY_END
+
+; this query gets the 0ttl answer
+STEP 230 QUERY
+ENTRY_BEGIN
+REPLY RD
+SECTION QUESTION
+www.example.com. IN A
+ENTRY_END
+
+STEP 240 CHECK_ANSWER
+ENTRY_BEGIN
+MATCH all
+REPLY QR RD RA NOERROR
+SECTION QUESTION
+www.example.com. IN A
+SECTION ANSWER
+www.example.com. 0 IN A 10.20.30.40
+ENTRY_END
+
+SCENARIO_END