]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix cdflag dns64 processing.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 19 Nov 2014 08:43:08 +0000 (08:43 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 19 Nov 2014 08:43:08 +0000 (08:43 +0000)
git-svn-id: file:///svn/unbound/trunk@3275 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
iterator/iterator.c
services/mesh.c
validator/validator.c

index 98fab2f4c0deb217f4beee3b6578f05e88330b53..b1fca5fd5c716b9983983c7dcae90b48cd00be12 100644 (file)
@@ -1,3 +1,6 @@
+19 November 2014: Wouter
+       - Fix cdflag dns64 processing.
+
 18 November 2014: Wouter
        - Fix that CD flag disables DNS64 processing, returning the DNSSEC
          signed AAAA denial.
index 5bd5796b7cec4fb2d29396b2cd05a20eda27eba0..843948a2e303ceed8bfc6bbd009e192151be3412 100644 (file)
@@ -487,6 +487,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
        uint16_t qflags = 0; /* OPCODE QUERY, no flags */
        struct query_info qinf;
        int prime = (finalstate == PRIME_RESP_STATE)?1:0;
+       int valrec = 0;
        qinf.qname = qname;
        qinf.qname_len = qnamelen;
        qinf.qtype = qtype;
@@ -500,12 +501,14 @@ 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.  */
-       if(!v)
+       if(!v) {
                qflags |= BIT_CD;
+               valrec = 1;
+       }
        
        /* attach subquery, lookup existing or make a new one */
        fptr_ok(fptr_whitelist_modenv_attach_sub(qstate->env->attach_sub));
-       if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, 0,
+       if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, valrec,
                &subq)) {
                return 0;
        }
index 780cb3e4df1bf627dd4f42b2b621ce5ac18a7816..a69aced223e34373e1dce9d9760df7e4415698bc 100644 (file)
@@ -282,7 +282,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
         uint16_t qflags, struct edns_data* edns, struct comm_reply* rep,
         uint16_t qid)
 {
-       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0, 0);
+       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
        int was_detached = 0;
        int was_noreply = 0;
        int added = 0;
@@ -312,7 +312,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
 #ifdef UNBOUND_DEBUG
                struct rbnode_t* n;
 #endif
-               s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0, 0);
+               s = mesh_state_create(mesh->env, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
                if(!s) {
                        log_err("mesh_state_create: out of memory; SERVFAIL");
                        error_encode(rep->c->buffer, LDNS_RCODE_SERVFAIL,
@@ -376,7 +376,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
        uint16_t qflags, struct edns_data* edns, sldns_buffer* buf, 
        uint16_t qid, mesh_cb_func_t cb, void* cb_arg)
 {
-       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0, 0);
+       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
        int was_detached = 0;
        int was_noreply = 0;
        int added = 0;
@@ -387,7 +387,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
 #ifdef UNBOUND_DEBUG
                struct rbnode_t* n;
 #endif
-               s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0, 0);
+               s = mesh_state_create(mesh->env, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
                if(!s) {
                        return 0;
                }
@@ -429,7 +429,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
 void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
         uint16_t qflags, time_t leeway)
 {
-       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0, 0);
+       struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
 #ifdef UNBOUND_DEBUG
        struct rbnode_t* n;
 #endif
@@ -448,7 +448,7 @@ void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
                mesh->stats_dropped ++;
                return;
        }
-       s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0, 0);
+       s = mesh_state_create(mesh->env, qinfo, qflags&(BIT_RD|BIT_CD), 0, 0);
        if(!s) {
                log_err("prefetch mesh_state_create: out of memory");
                return;
@@ -688,7 +688,6 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
        struct mesh_state* sub = mesh_area_find(mesh, qinfo, qflags, prime,
                valrec);
        int was_detached;
-       log_info("mesh attach sub: myvalrec is %d", qstate->is_valrec);
        if(mesh_detect_cycle_found(qstate, sub)) {
                verbose(VERB_ALGO, "attach failed, cycle detected");
                return 0;
index 1e929572f2557760f369cd55808fd51e0931c5f4..9d5d5c39025473a56ee1b549f0f4e8be6bf0220f 100644 (file)
@@ -283,12 +283,20 @@ needs_validation(struct module_qstate* qstate, int ret_rc,
 {
        int rcode;
 
-       /* If the CD bit is on in the original request, then we don't bother to
-        * validate anything.*/
+       /* If the CD bit is on in the original request, then you could think
+        * that we don't bother to validate anything.
+        * But this is signalled internally with the valrec flag.
+        * User queries are validated with BIT_CD to make our cache clean
+        * so that bogus messages get retried by the upstream also for
+        * downstream validators that set BIT_CD.
+        * For DNS64 bit_cd signals no dns64 processing, but we want to
+        * provide validation there too */
+       /*
        if(qstate->query_flags & BIT_CD) {
                verbose(VERB_ALGO, "not validating response due to CD bit");
                return 0;
        }
+       */
        if(qstate->is_valrec) {
                verbose(VERB_ALGO, "not validating response, is valrec"
                        "(validation recursion lookup)");