]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/resolve: invalidate NS than query on loops/failures
authorMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 28 May 2015 16:16:12 +0000 (18:16 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 28 May 2015 16:16:12 +0000 (18:16 +0200)
lib/resolve.c

index 7b25e846e737a69e44ba2a880b49267bdc07b8a6..92dbc7db6c900828dc614237c3a4e997483a8b9a 100644 (file)
@@ -47,16 +47,18 @@ static int ns_resolve_addr(struct kr_query *qry, struct kr_request *param)
         * this would lead to dependency loop in current zone cut.
         * Prefer IPv6 and continue with IPv4 if not available.
         */
-       uint16_t next_type = KNOT_RRTYPE_AAAA;
+       uint16_t next_type = 0;
        if (!(qry->flags & QUERY_AWAIT_IPV6)) {
                next_type = KNOT_RRTYPE_AAAA;
                qry->flags |= QUERY_AWAIT_IPV6;
        } else if (!(qry->flags & QUERY_AWAIT_IPV4)) {
                next_type = KNOT_RRTYPE_A;
                qry->flags |= QUERY_AWAIT_IPV4;
-       } else {
+       }
+       /* Bail out if the query is already pending or dependency loop. */
+       if (!next_type || kr_rplan_satisfies(qry->parent, qry->ns.name, KNOT_CLASS_IN, next_type)) {
                DEBUG_MSG("=> dependency loop, bailing out\n");
-               kr_rplan_pop(rplan, qry);
+               invalidate_ns(rplan, qry);
                return KNOT_STATE_PRODUCE;
        }