]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
layer/iterate: don't update cut if we get m10n referral/CNAME
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 27 Jun 2015 23:26:48 +0000 (01:26 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 27 Jun 2015 23:26:48 +0000 (01:26 +0200)
lib/layer/iterate.c
tests/testdata/iter_minim_nonempty.rpl

index 260ce0462eb98d0f7c28417cbb41bd00c52b45e0..a4e56357f9c0eb149617c2923aea7abbf3b6fd0c 100644 (file)
@@ -248,6 +248,15 @@ static int process_authority(knot_pkt_t *pkt, struct kr_request *req)
        }
 #endif
 
+       /* Work around servers sending back CNAME with different delegation and no AA. */
+       const knot_pktsection_t *an = knot_pkt_section(pkt, KNOT_ANSWER);
+       if (an->count > 0 && ns->count > 0) {
+               const knot_rrset_t *rr = knot_pkt_rr(an, 0);
+               if (rr->type == KNOT_RRTYPE_CNAME) {
+                       return KNOT_STATE_CONSUME;
+               }
+       }
+
        /* Update zone cut information. */
        for (unsigned i = 0; i < ns->count; ++i) {
                const knot_rrset_t *rr = knot_pkt_rr(ns, i);
@@ -261,16 +270,6 @@ static int process_authority(knot_pkt_t *pkt, struct kr_request *req)
                }
        }
 
-       /* Work around servers sending back CNAME with different delegation and no AA. */
-       const knot_pktsection_t *an = knot_pkt_section(pkt, KNOT_ANSWER);
-       if (result == KNOT_STATE_DONE && an->count > 0) {
-               const knot_rrset_t *rr = knot_pkt_rr(an, 0);
-               if (rr->type == KNOT_RRTYPE_CNAME) {
-                       DEBUG_MSG("<= different delegation, but has a CNAME answer\n");
-                       result = KNOT_STATE_CONSUME;
-               }
-       }
-
        /* CONSUME => Unhelpful referral.
         * DONE    => Zone cut updated. */
        return result;
index 44e88349c05f01b219e93023ffcf186b4c0dfec1..4649344804ed4339ac1627ffc78054d1e98d5692 100644 (file)
@@ -85,9 +85,12 @@ REPLY AA QR NOERROR
 SECTION QUESTION
 example.com. IN NS
 SECTION ANSWER
-example.com. IN CNAME nowhere.
+example.com. IN CNAME nowhere.cdn.example.com.
 SECTION AUTHORITY
-com.   IN NS   a.gtld-servers.net.
+; Suggest authority of 'nowhere' (which must not be followed)
+cdn.example.com. IN NS ns01.cdn.example.com.
+SECTION ADDITIONAL
+ns01.cdn.example.com. IN A 1.1.1.1
 ENTRY_END
 
 ENTRY_BEGIN