3 October 2007: Wouter
+ - fix for multiple empty nonterminals, after multiple DSes in the
+ chain of trust.
+ - mesh checks if modules are looping, and stops them.
- refetch with CNAMEd nameserver address regression test added.
1 October 2007: Wouter
mstate->reply_list = NULL;
rbtree_init(&mstate->super_set, &mesh_state_ref_compare);
rbtree_init(&mstate->sub_set, &mesh_state_ref_compare);
+ mstate->num_activated = 0;
/* init module qstate */
mstate->s.qinfo.qtype = qinfo->qtype;
mstate->s.qinfo.qclass = qinfo->qclass;
mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate,
enum module_ext_state s, enum module_ev* ev)
{
+ mstate->num_activated++;
+ if(mstate->num_activated > MESH_MAX_ACTIVATION) {
+ /* module is looping. Stop it. */
+ log_err("internal error: looping module stopped");
+ log_query_info(VERB_DETAIL, "pass error for qstate",
+ &mstate->s.qinfo);
+ s = module_error;
+ }
if(s == module_wait_module) {
/* start next module */
mstate->s.curmod++;
log_err("Cannot pass to next module; at last module");
log_query_info(VERB_DETAIL, "pass error for qstate",
&mstate->s.qinfo);
- log_assert(0); /* catch this for now */
mstate->s.curmod--;
return mesh_continue(mesh, mstate, module_error, ev);
}
struct outbound_entry;
struct timehist;
+/**
+ * Maximum number of mesh state activations. Any more is likely an
+ * infinite loop in the module. It is then terminated.
+ */
+#define MESH_MAX_ACTIVATION 1000
+
/**
* Mesh of query states
*/
/** set of substates (that this state needs to continue)
* contains struct mesh_state_ref* */
rbtree_t sub_set;
+ /** number of activations for the mesh state */
+ size_t num_activated;
};
/**
return 1;
}
- if(vq->empty_DS_name) {
+ if(vq->empty_DS_name && dname_strict_subdomain_c(vq->empty_DS_name,
+ current_key_name)) {
+ /* if the last empty nonterminal/emptyDS name we detected is
+ * below the current key, use that name to make progress
+ * along the chain of trust */
if(query_dname_compare(target_key_name,
vq->empty_DS_name) == 0) {
/* do not query for empty_DS_name again */