/**
* 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*
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
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. */
* 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)) {
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. */
* 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. */
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);
/* 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 */
}
* 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.
/** 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
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))
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);
}
/* 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 */
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;
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;
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;