]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
layer/iterate: workaround for leaf NS that can only do lame NODATA answer
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sun, 28 Jun 2015 23:56:23 +0000 (01:56 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sun, 28 Jun 2015 23:56:23 +0000 (01:56 +0200)
lib/layer/iterate.c

index a4e56357f9c0eb149617c2923aea7abbf3b6fd0c..127aa0352004618bfbfe71c78870d1817c85c253 100644 (file)
@@ -112,6 +112,12 @@ static bool is_authoritative(const knot_pkt_t *answer, struct kr_query *query)
                }
        }
 
+#ifndef STRICT_MODE
+       /* Last resort to work around broken auths, if the zone cut is at/parent of the QNAME. */
+       if (knot_dname_is_equal(query->zone_cut.name, knot_pkt_qname(answer))) {
+               return true;
+       }
+#endif
        return false;
 }
 
@@ -246,8 +252,7 @@ static int process_authority(knot_pkt_t *pkt, struct kr_request *req)
        if (knot_wire_get_aa(pkt->wire)) {
                return KNOT_STATE_CONSUME;
        }
-#endif
-
+#else
        /* 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) {
@@ -256,6 +261,7 @@ static int process_authority(knot_pkt_t *pkt, struct kr_request *req)
                        return KNOT_STATE_CONSUME;
                }
        }
+#endif
 
        /* Update zone cut information. */
        for (unsigned i = 0; i < ns->count; ++i) {