From: Wouter Wijngaards Date: Wed, 1 Aug 2007 12:59:37 +0000 (+0000) Subject: prime flag moved. X-Git-Tag: release-0.5~171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56916e48fb8a70f47e6b7eb2b6f90742e699d363;p=thirdparty%2Funbound.git prime flag moved. git-svn-id: file:///svn/unbound/trunk@470 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/daemon.c b/daemon/daemon.c index b24a9f59f..92672fc01 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -172,7 +172,7 @@ count_modules(const char* s) /** * Get funcblock for module name - * @param str: string with module name. Advanced to next value. + * @param str: string with module name. Advanced to next value on success. * @return funcblock or NULL on error. */ static struct module_func_block* diff --git a/iterator/iter_utils.c b/iterator/iter_utils.c index 73d4b7269..22a46dea1 100644 --- a/iterator/iter_utils.c +++ b/iterator/iter_utils.c @@ -365,7 +365,8 @@ causes_cycle(struct module_qstate* qstate, uint8_t* name, size_t namelen, qinf.qname_len = namelen; qinf.qtype = t; qinf.qclass = c; - return (*qstate->env->detect_cycle)(qstate, &qinf, BIT_RD, 0); + return (*qstate->env->detect_cycle)(qstate, &qinf, BIT_RD, + qstate->is_priming); } void diff --git a/iterator/iterator.c b/iterator/iterator.c index 2234f0657..c195f92c7 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -111,8 +111,7 @@ iter_new(struct module_qstate* qstate, int id) iq->num_current_queries = 0; iq->query_restart_count = 0; iq->referral_count = 0; - iq->priming = 0; - iq->priming_stub = 0; + iq->wait_priming_stub = 0; iq->refetch_glue = 0; iq->chase_flags = qstate->query_flags; /* Start with the (current) qname. */ @@ -375,9 +374,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype, * the resolution chain, which might have a validator. We are * uninterested in validating things not on the direct resolution * path. */ - /* Turned off! CD does not make a difference in query results. - qstate->query_flags |= BIT_CD; - */ + qflags |= BIT_CD; /* attach subquery, lookup existing or make a new one */ if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, &subq)) { @@ -447,7 +444,6 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, subiq->dp = dp; /* there should not be any target queries. */ subiq->num_target_queries = 0; - subiq->priming = 1; } /* this module stops, our submodule starts, and does the query. */ @@ -504,8 +500,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, * wouldn't be anyway, since stub hints never have * missing targets. */ subiq->num_target_queries = 0; - subiq->priming = 1; - subiq->priming_stub = 1; + subiq->wait_priming_stub = 1; } /* this module stops, our submodule starts, and does the query. */ @@ -1190,7 +1185,7 @@ prime_supers(struct module_qstate* qstate, int id, struct module_qstate* forq) enum response_type type = response_type_from_server(iq->response, &iq->qchase, iq->dp); - log_assert(iq->priming || iq->priming_stub); + log_assert(qstate->is_priming || foriq->wait_priming_stub); if(type == RESPONSE_TYPE_ANSWER) { /* Convert our response to a delegation point */ dp = delegpt_from_message(iq->response, forq->region); @@ -1218,9 +1213,10 @@ prime_supers(struct module_qstate* qstate, int id, struct module_qstate* forq) /* root priming responses go to init stage 2, priming stub * responses to to stage 3. */ - if(iq->priming_stub) + if(foriq->wait_priming_stub) { foriq->state = INIT_REQUEST_3_STATE; - else foriq->state = INIT_REQUEST_2_STATE; + foriq->wait_priming_stub = 0; + } else foriq->state = INIT_REQUEST_2_STATE; /* because we are finished, the parent will be reactivated */ } @@ -1257,7 +1253,7 @@ processPrimeResponse(struct module_qstate* qstate, int id) * to received target responses (caching, updating the current delegation * point, etc). * Callback from walk_supers for every super state that is interested in - * the results from thiis query. + * the results from this query. * * @param qstate: query state. * @param id: module id. diff --git a/iterator/iterator.h b/iterator/iterator.h index b10261338..fa7146950 100644 --- a/iterator/iterator.h +++ b/iterator/iterator.h @@ -215,18 +215,11 @@ struct iter_qstate { /** the number of times this query as followed a referral. */ int referral_count; - /** - * This flag, if true, means that this event is a priming query. - * In that case priming stub may be set as well. - */ - int priming; - /** * This is flag that, if true, means that this event is - * representing a stub priming query. It is meaningless unless - * the finalState is the PRIMING_RESP_STATE. + * waiting for a stub priming query. */ - int priming_stub; + int wait_priming_stub; /** * This is a flag that, if true, means that this query is diff --git a/services/mesh.c b/services/mesh.c index df0d4372b..8c7ff7e3b 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -59,9 +59,9 @@ mesh_state_compare(const void* ap, const void* bp) struct mesh_state* a = (struct mesh_state*)ap; struct mesh_state* b = (struct mesh_state*)bp; - if(a->is_priming && !b->is_priming) + if(a->s.is_priming && !b->s.is_priming) return -1; - if(!a->is_priming && b->is_priming) + if(!a->s.is_priming && b->s.is_priming) return 1; if((a->s.query_flags&BIT_RD) && !(b->s.query_flags&BIT_RD)) @@ -212,7 +212,6 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo, mstate->node.key = mstate; mstate->run_node.key = mstate; mstate->debug_flags = 0; - mstate->is_priming = prime; mstate->reply_list = NULL; rbtree_init(&mstate->super_set, &mesh_state_ref_compare); rbtree_init(&mstate->sub_set, &mesh_state_ref_compare); @@ -228,9 +227,12 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo, } /* remove all weird bits from qflags */ mstate->s.query_flags = (qflags & (BIT_RD|BIT_CD)); + mstate->s.is_priming = prime; mstate->s.reply = NULL; mstate->s.region = region; mstate->s.curmod = 0; + mstate->s.return_rep = 0; + mstate->s.return_rcode = LDNS_RCODE_NOERROR; mstate->s.env = env; mstate->s.mesh_info = mstate; /* init modules */ @@ -497,7 +499,7 @@ struct mesh_state* mesh_area_find(struct mesh_area* mesh, struct mesh_state* result; key.node.key = &key; - key.is_priming = prime; + key.s.is_priming = prime; key.s.qinfo = *qinfo; key.s.query_flags = qflags; diff --git a/services/mesh.h b/services/mesh.h index abb7083b2..83d3af7d6 100644 --- a/services/mesh.h +++ b/services/mesh.h @@ -106,8 +106,6 @@ struct mesh_state { rbnode_t node; /** node in mesh_area runnable tree, key is this struct */ rbnode_t run_node; - /** if this is a (stub or root) priming query (with hints) */ - int is_priming; /** the query state. Note that the qinfo and query_flags * may not change. */ struct module_qstate s; diff --git a/util/module.h b/util/module.h index b19e19768..340e37c47 100644 --- a/util/module.h +++ b/util/module.h @@ -271,9 +271,15 @@ struct module_qstate { struct query_info qinfo; /** flags uint16 from query */ uint16_t query_flags; + /** if this is a (stub or root) priming query (with hints) */ + int is_priming; /** comm_reply contains server replies */ struct comm_reply* reply; + /** the reply info, with message for client, calling module */ + struct reply_info* return_rep; + /** the rcode, in case of error, instead of a reply info message */ + int return_rcode; /** region for this query. Cleared when query process finishes. */ struct region* region;