From: Wouter Wijngaards Date: Tue, 13 Mar 2018 13:14:56 +0000 (+0000) Subject: Test and fix. X-Git-Tag: release-1.7.1rc1~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a287a70cd2696fc2f3f6ed37f645d1ffe429e90;p=thirdparty%2Funbound.git Test and fix. git-svn-id: file:///svn/unbound/trunk@4583 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/services/cache/dns.c b/services/cache/dns.c index 382b32962..35adc35b5 100644 --- a/services/cache/dns.c +++ b/services/cache/dns.c @@ -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 index 000000000..f1a6dc629 --- /dev/null +++ b/testdata/fwd_0ttlservfail.rpl @@ -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