mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-22 07:41:16 -05:00
fixup validator classification of root referrals.
git-svn-id: file:///svn/unbound/trunk@936 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
04edbb68b7
commit
09e18ffdbb
4 changed files with 22 additions and 11 deletions
|
|
@ -2,6 +2,8 @@
|
||||||
- test program for multiple queries over a TCP channel.
|
- test program for multiple queries over a TCP channel.
|
||||||
- tpkg test for stream tcp queries.
|
- tpkg test for stream tcp queries.
|
||||||
- unbound replies to multiple TCP queries on a TCP channel.
|
- unbound replies to multiple TCP queries on a TCP channel.
|
||||||
|
- fixup misclassification of root referral with NS in answer
|
||||||
|
when validating a nonrec query.
|
||||||
|
|
||||||
7 February 2008: Wouter
|
7 February 2008: Wouter
|
||||||
- moved up all current level 2 to be level 3. And 3 to 4.
|
- moved up all current level 2 to be level 3. And 3 to 4.
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,8 @@
|
||||||
#include "util/regional.h"
|
#include "util/regional.h"
|
||||||
|
|
||||||
enum val_classification
|
enum val_classification
|
||||||
val_classify_response(uint16_t query_flags, struct query_info* qinf,
|
val_classify_response(uint16_t query_flags, struct query_info* origqinf,
|
||||||
struct reply_info* rep, size_t skip)
|
struct query_info* qinf, struct reply_info* rep, size_t skip)
|
||||||
{
|
{
|
||||||
int rcode = (int)FLAGS_GET_RCODE(rep->flags);
|
int rcode = (int)FLAGS_GET_RCODE(rep->flags);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -82,6 +82,13 @@ val_classify_response(uint16_t query_flags, struct query_info* qinf,
|
||||||
}
|
}
|
||||||
return saw_ns?VAL_CLASS_REFERRAL:VAL_CLASS_NODATA;
|
return saw_ns?VAL_CLASS_REFERRAL:VAL_CLASS_NODATA;
|
||||||
}
|
}
|
||||||
|
/* root referral where NS set is in the answer section */
|
||||||
|
if(!(query_flags&BIT_RD) && rep->ns_numrrsets == 0 &&
|
||||||
|
rep->an_numrrsets == 1 && rcode == LDNS_RCODE_NOERROR &&
|
||||||
|
ntohs(rep->rrsets[0]->rk.type) == LDNS_RR_TYPE_NS &&
|
||||||
|
query_dname_compare(rep->rrsets[0]->rk.dname,
|
||||||
|
origqinf->qname) != 0)
|
||||||
|
return VAL_CLASS_REFERRAL;
|
||||||
|
|
||||||
/* dump bad messages */
|
/* dump bad messages */
|
||||||
if(rcode != LDNS_RCODE_NOERROR)
|
if(rcode != LDNS_RCODE_NOERROR)
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@ enum val_classification {
|
||||||
/**
|
/**
|
||||||
* Given a response, classify ANSWER responses into a subtype.
|
* Given a response, classify ANSWER responses into a subtype.
|
||||||
* @param query_flags: query flags for the original query.
|
* @param query_flags: query flags for the original query.
|
||||||
|
* @param origqinf: query info. The original query name.
|
||||||
* @param qinf: query info. The chased query name.
|
* @param qinf: query info. The chased query name.
|
||||||
* @param rep: response. The original response.
|
* @param rep: response. The original response.
|
||||||
* @param skip: offset into the original response answer section.
|
* @param skip: offset into the original response answer section.
|
||||||
|
|
@ -88,7 +89,8 @@ enum val_classification {
|
||||||
* Then, another CNAME type, CNAME_NOANSWER or POSITIVE are possible.
|
* Then, another CNAME type, CNAME_NOANSWER or POSITIVE are possible.
|
||||||
*/
|
*/
|
||||||
enum val_classification val_classify_response(uint16_t query_flags,
|
enum val_classification val_classify_response(uint16_t query_flags,
|
||||||
struct query_info* qinf, struct reply_info* rep, size_t skip);
|
struct query_info* origqinf, struct query_info* qinf,
|
||||||
|
struct reply_info* rep, size_t skip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a response, determine the name of the "signer". This is primarily
|
* Given a response, determine the name of the "signer". This is primarily
|
||||||
|
|
|
||||||
|
|
@ -1090,8 +1090,8 @@ processInit(struct module_qstate* qstate, struct val_qstate* vq,
|
||||||
uint8_t* lookup_name;
|
uint8_t* lookup_name;
|
||||||
size_t lookup_len;
|
size_t lookup_len;
|
||||||
enum val_classification subtype = val_classify_response(
|
enum val_classification subtype = val_classify_response(
|
||||||
qstate->query_flags, &vq->qchase, vq->orig_msg->rep,
|
qstate->query_flags, &qstate->qinfo, &vq->qchase,
|
||||||
vq->rrset_skip);
|
vq->orig_msg->rep, vq->rrset_skip);
|
||||||
verbose(VERB_ALGO, "validator classification %s",
|
verbose(VERB_ALGO, "validator classification %s",
|
||||||
val_classification_to_string(subtype));
|
val_classification_to_string(subtype));
|
||||||
if(subtype == VAL_CLASS_REFERRAL &&
|
if(subtype == VAL_CLASS_REFERRAL &&
|
||||||
|
|
@ -1388,8 +1388,8 @@ processValidate(struct module_qstate* qstate, struct val_qstate* vq,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
subtype = val_classify_response(qstate->query_flags, &vq->qchase,
|
subtype = val_classify_response(qstate->query_flags, &qstate->qinfo,
|
||||||
vq->orig_msg->rep, vq->rrset_skip);
|
&vq->qchase, vq->orig_msg->rep, vq->rrset_skip);
|
||||||
switch(subtype) {
|
switch(subtype) {
|
||||||
case VAL_CLASS_POSITIVE:
|
case VAL_CLASS_POSITIVE:
|
||||||
verbose(VERB_ALGO, "Validating a positive response");
|
verbose(VERB_ALGO, "Validating a positive response");
|
||||||
|
|
@ -1478,8 +1478,8 @@ processFinished(struct module_qstate* qstate, struct val_qstate* vq,
|
||||||
struct val_env* ve, int id)
|
struct val_env* ve, int id)
|
||||||
{
|
{
|
||||||
enum val_classification subtype = val_classify_response(
|
enum val_classification subtype = val_classify_response(
|
||||||
qstate->query_flags, &vq->qchase, vq->orig_msg->rep,
|
qstate->query_flags, &qstate->qinfo, &vq->qchase,
|
||||||
vq->rrset_skip);
|
vq->orig_msg->rep, vq->rrset_skip);
|
||||||
|
|
||||||
/* store overall validation result in orig_msg */
|
/* store overall validation result in orig_msg */
|
||||||
if(vq->rrset_skip == 0)
|
if(vq->rrset_skip == 0)
|
||||||
|
|
@ -1787,7 +1787,7 @@ ds_response_to_ke(struct module_qstate* qstate, struct val_qstate* vq,
|
||||||
goto return_bogus;
|
goto return_bogus;
|
||||||
}
|
}
|
||||||
|
|
||||||
subtype = val_classify_response(BIT_RD, qinfo, msg->rep, 0);
|
subtype = val_classify_response(BIT_RD, qinfo, qinfo, msg->rep, 0);
|
||||||
if(subtype == VAL_CLASS_POSITIVE) {
|
if(subtype == VAL_CLASS_POSITIVE) {
|
||||||
struct ub_packed_rrset_key* ds;
|
struct ub_packed_rrset_key* ds;
|
||||||
enum sec_status sec;
|
enum sec_status sec;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue