]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Make capsforid fallback QNAME minimisation aware.
authorRalph Dolmans <ralph@nlnetlabs.nl>
Tue, 7 Aug 2018 12:43:49 +0000 (12:43 +0000)
committerRalph Dolmans <ralph@nlnetlabs.nl>
Tue, 7 Aug 2018 12:43:49 +0000 (12:43 +0000)
git-svn-id: file:///svn/unbound/trunk@4840 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
iterator/iterator.c
iterator/iterator.h

index 3d7939bfb93a1b6a58aa861a2bc25759f6de2b8e..217f65024bb5a5bb5df5a5b3933aceb6608718c2 100644 (file)
@@ -1,3 +1,6 @@
+7 August 2018: Ralph
+       - Make capsforid fallback QNAME minimisation aware.
+
 7 August 2018: Wouter
        - Fix #4142: unbound.service.in: improvements and fixes.
          Add unit dependency ordering (based on systemd-resolved).
index f6bb30bf26450575622bc17fb6914dd275ee4975..331a8aa7b7886ba15675ea60e9e271c5f021dc70 100644 (file)
@@ -3448,6 +3448,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
                        iq->caps_server = 0;
                        iq->caps_reply = NULL;
                        iq->caps_response = NULL;
+                       iq->caps_minimisation_state = DONOT_MINIMISE_STATE;
                        iq->state = QUERYTARGETS_STATE;
                        iq->num_current_queries--;
                        /* need fresh attempts for the 0x20 fallback, if
@@ -3514,6 +3515,7 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
                        iq->caps_server = 0;
                        iq->caps_reply = NULL;
                        iq->caps_response = NULL;
+                       iq->caps_minimisation_state = DONOT_MINIMISE_STATE;
                        iq->state = QUERYTARGETS_STATE;
                        iq->num_current_queries--;
                        verbose(VERB_DETAIL, "Capsforid: scrub failed, starting fallback with no response");
@@ -3533,15 +3535,30 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
                        iq->response->rep);
        
        if(event == module_event_capsfail || iq->caps_fallback) {
+               if(qstate->env->cfg->qname_minimisation &&
+                       iq->minimisation_state != DONOT_MINIMISE_STATE) {
+                       /* Skip QNAME minimisation for next query, since that
+                        * one has to match the current query. */
+                       iq->minimisation_state = SKIP_MINIMISE_STATE;
+               }
                /* for fallback we care about main answer, not additionals */
                /* removing that makes comparison more likely to succeed */
                caps_strip_reply(iq->response->rep);
+
+               if(iq->caps_fallback &&
+                       iq->caps_minimisation_state != iq->minimisation_state) {
+                       /* QNAME minimisation state has changed, restart caps
+                        * fallback. */
+                       iq->caps_fallback = 0;
+               }
+
                if(!iq->caps_fallback) {
                        /* start fallback */
                        iq->caps_fallback = 1;
                        iq->caps_server = 0;
                        iq->caps_reply = iq->response->rep;
                        iq->caps_response = iq->response;
+                       iq->caps_minimisation_state = iq->minimisation_state;
                        iq->state = QUERYTARGETS_STATE;
                        iq->num_current_queries--;
                        verbose(VERB_DETAIL, "Capsforid: starting fallback");
index 67ffeb14763180519bdd212e344176a156d7cf9e..57cb7c4c474e048799e45c4e43128157c9a768d3 100644 (file)
@@ -371,6 +371,9 @@ struct iter_qstate {
        /** QNAME minimisation state, RFC7816 */
        enum minimisation_state minimisation_state;
 
+       /** State for capsfail: QNAME minimisation state for comparisons. */
+       enum minimisation_state caps_minimisation_state;
+
        /**
         * The query info that is sent upstream. Will be a subset of qchase
         * when qname minimisation is enabled.