]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
passing of control between modules.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Aug 2007 12:13:08 +0000 (12:13 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Aug 2007 12:13:08 +0000 (12:13 +0000)
git-svn-id: file:///svn/unbound/trunk@479 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
iterator/iterator.c
services/mesh.c
util/module.c
util/module.h
validator/validator.c

index dfbe1b0c97a97c167bcefb9b5a7d87e76c3ce939..f0574e59eab8e7df4299d0d3c7acdcc3d99689b2 100644 (file)
@@ -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
index 505ab06fa24cd6b48244d16019670f64c9b3717c..2141d2aeb4c546e57157a207c8f3bc6898734db7 100644 (file)
@@ -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, 
index 8a177fca58f33e1729d02844d65f82f5b211d57f..7ec5a82b2b8f576610293a10db044a4f68b82399 100644 (file)
@@ -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;
index ecb94b67e14477be4162802f7a1fc5a32a38312c..60c9489ecca5f5ef466a6001f6a5013e9b91df44 100644 (file)
@@ -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";
index bc9c13644bd024a68fd24f21db30adc06ff1e661..cf8c0e8b3477fe116ff1bd44ce5070cd687a798d 100644 (file)
@@ -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
 };
index 371c15120681e47f67fa1c19944ce87fb4d1aad2..d6092f2b38bfda5d2f42dd3154e7133cdaa1c13e 100644 (file)
@@ -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);
 }