mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-01 04:19:36 -05:00
- bug#327: Fix for cannot access stub zones until the root is primed.
git-svn-id: file:///svn/unbound/trunk@2228 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
f26b55ea7e
commit
95db04a64c
5 changed files with 168 additions and 1 deletions
|
|
@ -1,3 +1,6 @@
|
|||
13 September 2010: Wouter
|
||||
- bug#327: Fix for cannot access stub zones until the root is primed.
|
||||
|
||||
9 September 2010: Wouter
|
||||
- unresponsive servers are not completely blacklisted (because of
|
||||
firewalls), but also not probed all the time (because of the request
|
||||
|
|
|
|||
|
|
@ -451,6 +451,13 @@ hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
|
|||
len, labs, qclass);
|
||||
if(!r) return NULL;
|
||||
|
||||
/* If there is no cache (root prime situation) */
|
||||
if(cache_dp == NULL) {
|
||||
if(r->dp->namelabs != 1)
|
||||
return r; /* no cache dp, use any non-root stub */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the stub is same as the delegation we got
|
||||
* And has noprime set, we need to 'prime' to use this stub instead.
|
||||
|
|
|
|||
|
|
@ -594,6 +594,8 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
* @param q: request name.
|
||||
* @return true if a priming subrequest was made, false if not. The will only
|
||||
* issue a priming request if it detects an unprimed stub.
|
||||
* Uses value of 2 to signal during stub-prime in root-prime situation
|
||||
* that a noprime-stub is available and resolution can continue.
|
||||
*/
|
||||
static int
|
||||
prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
|
|
@ -619,6 +621,8 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
|
||||
/* is it a noprime stub (always use) */
|
||||
if(stub->noprime) {
|
||||
int r = 0;
|
||||
if(iq->dp == NULL) r = 2;
|
||||
/* copy the dp out of the fixed hints structure, so that
|
||||
* it can be changed when servicing this query */
|
||||
iq->dp = delegpt_copy(stub_dp, qstate->region);
|
||||
|
|
@ -629,7 +633,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
}
|
||||
log_nametypeclass(VERB_DETAIL, "use stub", stub_dp->name,
|
||||
LDNS_RR_TYPE_NS, q->qclass);
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Otherwise, we need to (re)prime the stub. */
|
||||
|
|
@ -1031,6 +1035,12 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
|||
/* If the cache has returned nothing, then we have a
|
||||
* root priming situation. */
|
||||
if(iq->dp == NULL) {
|
||||
/* if there is a stub, then no root prime needed */
|
||||
int r = prime_stub(qstate, iq, ie, id, &iq->qchase);
|
||||
if(r == 2)
|
||||
break; /* got noprime-stub-zone, continue */
|
||||
else if(r)
|
||||
return 0; /* stub prime request made */
|
||||
if(forwards_lookup_root(qstate->env->fwds,
|
||||
iq->qchase.qclass)) {
|
||||
/* forward zone root, no root prime needed */
|
||||
|
|
|
|||
64
testdata/iter_stub_noroot.rpl
vendored
Normal file
64
testdata/iter_stub_noroot.rpl
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
; config options
|
||||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 81.187.81.187
|
||||
stub-zone:
|
||||
name: "lp0.eu"
|
||||
stub-addr: 81.2.80.65
|
||||
stub-prime: no
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test resolve of stub zone without root prime.
|
||||
|
||||
; this server does not respond. (for the root)
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 81.187.81.187
|
||||
ENTRY_BEGIN
|
||||
MATCH
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR SERVFAIL
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; lp0.eu server
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 81.2.80.65
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
SECTION ANSWER
|
||||
proxima.lp0.eu. IN A 81.2.80.65
|
||||
SECTION AUTHORITY
|
||||
lp0.eu. IN NS proxima.lp0.eu.
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
SECTION ANSWER
|
||||
proxima.lp0.eu. IN A 81.2.80.65
|
||||
SECTION AUTHORITY
|
||||
lp0.eu. IN NS proxima.lp0.eu.
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
83
testdata/val_stub_noroot.rpl
vendored
Normal file
83
testdata/val_stub_noroot.rpl
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
; config options
|
||||
server:
|
||||
target-fetch-policy: "0 0 0 0 0"
|
||||
trust-anchor: "lp0.eu. IN DNSKEY 257 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3"
|
||||
val-override-date: "20100913111500"
|
||||
; the dlv anchor is completely ignored, but here to test that.
|
||||
dlv-anchor: "dlv.isc.org. IN DNSKEY 257 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3"
|
||||
|
||||
stub-zone:
|
||||
name: "."
|
||||
stub-addr: 81.187.81.187
|
||||
stub-zone:
|
||||
name: "lp0.eu"
|
||||
stub-addr: 81.2.80.65
|
||||
stub-prime: no
|
||||
CONFIG_END
|
||||
|
||||
SCENARIO_BEGIN Test validation of stub zone without root prime.
|
||||
|
||||
; this server does not respond. (for the root)
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 81.187.81.187
|
||||
ENTRY_BEGIN
|
||||
MATCH
|
||||
ADJUST copy_id copy_query
|
||||
REPLY QR SERVFAIL
|
||||
SECTION QUESTION
|
||||
. IN NS
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
; lp0.eu server
|
||||
RANGE_BEGIN 0 100
|
||||
ADDRESS 81.2.80.65
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
lp0.eu. IN DNSKEY
|
||||
SECTION ANSWER
|
||||
lp0.eu. 3600 IN DNSKEY 257 3 5 AQPQ41chR9DEHt/aIzIFAqanbDlRflJoRs5yz1jFsoRIT7dWf0r+PeDuewdxkszNH6wnU4QL8pfKFRh5PIYVBLK3 ;{id = 30900 (ksk), size = 512b}
|
||||
lp0.eu. 3600 IN RRSIG DNSKEY 5 2 3600 20101013111500 20100909111500 30900 lp0.eu. zWYOT1zmB2k7hMl7mke7k1UNp4lDveUxi2EnF0tW++j2/qJopiAAcFHBo2GOo88jHcLWycurf0Qo+YGXfFbpEg== ;{id = 30900}
|
||||
ENTRY_END
|
||||
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR NOERROR
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
SECTION ANSWER
|
||||
proxima.lp0.eu. IN A 81.2.80.65
|
||||
proxima.lp0.eu. 3600 IN RRSIG A 5 3 3600 20101013111500 20100909111500 30900 lp0.eu. xwS3PLSlxh500pDYh/t6fnLzxQAra6n3nhzk4fVqLzwmneBIfcx4F/vO44wRzXSprz1UbMkVUcruTbQYlLFBEg== ;{id = 30900}
|
||||
SECTION AUTHORITY
|
||||
lp0.eu. IN NS proxima.lp0.eu.
|
||||
lp0.eu. 3600 IN RRSIG NS 5 2 3600 20101013111500 20100909111500 30900 lp0.eu. KM7Zfwc1b0Ay8Ezer0ZAERPbmgGzKIrTfZMxzXzSkVx5DWirTtdgPTNVG/y9fkN4tUARNhElN2eb0ufb04Hdgw== ;{id = 30900}
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD DO
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
ENTRY_END
|
||||
|
||||
; recursion happens here.
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH all
|
||||
REPLY QR RD RA AD NOERROR
|
||||
SECTION QUESTION
|
||||
proxima.lp0.eu. IN A
|
||||
SECTION ANSWER
|
||||
proxima.lp0.eu. IN A 81.2.80.65
|
||||
proxima.lp0.eu. 3600 IN RRSIG A 5 3 3600 20101013111500 20100909111500 30900 lp0.eu. xwS3PLSlxh500pDYh/t6fnLzxQAra6n3nhzk4fVqLzwmneBIfcx4F/vO44wRzXSprz1UbMkVUcruTbQYlLFBEg== ;{id = 30900}
|
||||
SECTION AUTHORITY
|
||||
lp0.eu. IN NS proxima.lp0.eu.
|
||||
lp0.eu. 3600 IN RRSIG NS 5 2 3600 20101013111500 20100909111500 30900 lp0.eu. KM7Zfwc1b0Ay8Ezer0ZAERPbmgGzKIrTfZMxzXzSkVx5DWirTtdgPTNVG/y9fkN4tUARNhElN2eb0ufb04Hdgw== ;{id = 30900}
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
Loading…
Reference in a new issue