From: Wouter Wijngaards Date: Thu, 2 Aug 2007 12:13:08 +0000 (+0000) Subject: passing of control between modules. X-Git-Tag: release-0.5~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6849c1030b1f6e94f6b5dc7bbd39e6216719d609;p=thirdparty%2Funbound.git passing of control between modules. git-svn-id: file:///svn/unbound/trunk@479 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index dfbe1b0c9..f0574e59e 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -4,6 +4,8 @@ - fixup delegation point duplicates. - fixup iterator scrubber; lame NS set is let through the scrubber so that the classification is lame. + - validator module exists, and does nothing but pass through, + with calling of next module and return. 1 August 2007: Wouter - set version to 0.5 diff --git a/iterator/iterator.c b/iterator/iterator.c index 505ab06fa..2141d2aeb 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1502,6 +1502,8 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq, /* edns is not examined, but removed from message to help cache */ if(parse_extract_edns(prs, &edns) != LDNS_RCODE_NOERROR) goto handle_it; + /* remove CD-bit, we asked for in case we handle validation ourself */ + prs->flags &= ~BIT_CD; /* normalize and sanitize: easy to delete items from linked lists */ if(!scrub_message(pkt, prs, &iq->qchase, iq->dp->name, diff --git a/services/mesh.c b/services/mesh.c index 8a177fca5..7ec5a82b2 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -484,7 +484,7 @@ void mesh_walk_supers(struct module_qstate* qstate, int id) (void)rbtree_insert(&mesh->run, &ref->s->run_node); /* callback the function to inform super of result */ (*mesh->modfunc[ref->s->s.curmod]->inform_super)(qstate, - id, &ref->s->s); + ref->s->s.curmod, &ref->s->s); } } @@ -570,7 +570,7 @@ mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate, } /* pass along the locus of control */ mstate->s.curmod --; - *ev = module_event_pass; + *ev = module_event_moddone; return 1; } return 0; diff --git a/util/module.c b/util/module.c index ecb94b67e..60c9489ec 100644 --- a/util/module.c +++ b/util/module.c @@ -62,6 +62,7 @@ strmodulevent(enum module_ev e) case module_event_pass: return "module_event_pass"; case module_event_reply: return "module_event_reply"; case module_event_noreply: return "module_event_noreply"; + case module_event_moddone: return "module_event_moddone"; case module_event_error: return "module_event_error"; } return "bad_event_value"; diff --git a/util/module.h b/util/module.h index bc9c13644..cf8c0e8b3 100644 --- a/util/module.h +++ b/util/module.h @@ -225,6 +225,8 @@ enum module_ev { module_event_reply, /** no reply, timeout or other error */ module_event_noreply, + /** next module is done, and its reply is awaiting you */ + module_event_moddone, /** error */ module_event_error }; diff --git a/validator/validator.c b/validator/validator.c index 371c15120..d6092f2b3 100644 --- a/validator/validator.c +++ b/validator/validator.c @@ -83,10 +83,24 @@ val_operate(struct module_qstate* qstate, enum module_ev event, int id, verbose(VERB_DETAIL, "validator[module %d] operate: extstate:%s " "event:%s", id, strextstate(qstate->ext_state[id]), strmodulevent(event)); - if(vq) log_query_info(VERB_DETAIL, "iterator operate: query", + if(vq) log_query_info(VERB_DETAIL, "validator operate: query", &qstate->qinfo); (void)ve; (void)outbound; + if(event == module_event_new || event == module_event_pass) { + /* pass request to next module, to get it */ + verbose(VERB_ALGO, "validator: pass to next module"); + qstate->ext_state[id] = module_wait_module; + return; + } + if(event == module_event_moddone) { + /* we're done */ + verbose(VERB_ALGO, "validator: nextmodule returned"); + qstate->ext_state[id] = module_finished; + return; + } + qstate->ext_state[id] = module_error; + return; } /** @@ -100,6 +114,9 @@ static void val_inform_super(struct module_qstate* qstate, int id, struct module_qstate* super) { + log_query_info(VERB_ALGO, "validator: inform_super, sub=", + &qstate->qinfo); + log_query_info(VERB_ALGO, "super=", &super->qinfo); }