]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
iterator: fix handling of ANY queries and != IN classes. docs-develop-fix-gakq6a/deployments/4846
authormenakite <29005531+menakite@users.noreply.github.com>
Sun, 11 Aug 2024 02:07:32 +0000 (04:07 +0200)
committermenakite <29005531+menakite@users.noreply.github.com>
Sun, 11 Aug 2024 02:07:32 +0000 (04:07 +0200)
It was supposed to answer NOTIMP, but was returning FAIL instead of
DONE and so the answer was SERVFAIL.

Also added EDE code "Not Supported" for clarity.

lib/layer/iterate.c

index 69fe344c4e2daf290ef34b42f90bbe9f9681ad3b..c6f9ec9761839e1c9bcbb2fbc79fba2d9f3463c0 100644 (file)
@@ -922,14 +922,14 @@ static int begin(kr_layer_t *ctx)
        }
 
        struct kr_query *qry = ctx->req->current_query;
-       /* Avoid any other classes, and avoid any meta-types ~~except for ANY~~. */
-       if (qry->sclass != KNOT_CLASS_IN
-           || (knot_rrtype_is_metatype(qry->stype)
-                   /* && qry->stype != KNOT_RRTYPE_ANY hmm ANY seems broken ATM */)) {
+       /* Avoid any other classes, and avoid any meta-types. */
+       if (qry->sclass != KNOT_CLASS_IN || knot_rrtype_is_metatype(qry->stype)) {
                knot_pkt_t *ans = kr_request_ensure_answer(ctx->req);
-               if (!ans) return ctx->req->state;
+               if (!ans)
+                       return ctx->req->state;
                knot_wire_set_rcode(ans->wire, KNOT_RCODE_NOTIMPL);
-               return KR_STATE_FAIL;
+               kr_request_set_extended_error(ctx->req, KNOT_EDNS_EDE_NOTSUP, "57CK");
+               return KR_STATE_DONE;
        }
 
        return reset(ctx);