iterator: fix handling of ANY queries and != IN classes.
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.
Note: ANY is not "broken", it is just not handled anywhere:
MacBook-Air:knot-resolver fix-any-chaos-notimp|u= menakite$ ack ANY lib
lib/layer/iterate.c
129:/** @internal Filter ANY or loopback addresses. */
133: /* Filter ANY and 127.0.0.0/8 */
143: /* All except last byte are zeroed, last byte defines ANY/::1 */
lib/resolve-produce.c
669: /* This query has RD=0 or is ANY, stop here. */
670: if (qry->stype == KNOT_RRTYPE_ANY ||
672: VERBOSE_MSG(qry, "=> qtype is ANY or RD=0, bail out\n");
Taking into consideration RFC 8482, I'd leave it as is.
Before/after (odvr.nic.cz running stable, ::1 has patch):
MacBook-Air:~ menakite$ q any www.nic.cz @odvr.nic.cz @::1
DEBU[0000] Name: www.nic.cz
DEBU[0000] RR types: [ANY]
DEBU[0000] Server(s): [odvr.nic.cz ::1]
DEBU[0000] Using server odvr.nic.cz:53 with transport plain
DEBU[0000] Using UDP with TCP fallback: odvr.nic.cz:53
DEBU[0000] Using server [::1]:53 with transport plain
DEBU[0000] Using UDP with TCP fallback: [::1]:53
NSID: 227@dns2 (odvr.nic.cz:53)
Question:
www.nic.cz. ANY
Additional:
. 32768 OPT ;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: do; udp: 1232
; NSID: 32323740646e7332 (2)(2)(7)(@)(d)(n)(s)(2) (odvr.nic.cz:53)
Stats:
Received 51 B from odvr.nic.cz:53 in 45.9ms (04:06:49 08-11-2024 CEST)
Opcode: QUERY Status: SERVFAIL ID 7238: Flags: qr rd ra (1 Q 0 A 0 N 1 E)
Question:
www.nic.cz. ANY
Additional:
. 32768 OPT ;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: do; udp: 1232
; NSID: 4d6163426f6f6b2d4169722d3930323536 (M)(a)(c)(B)(o)(o)(k)(-)(A)(i)(r)(-)(9)(0)(2)(5)(6)
; EDE: 21 (Not Supported): (57CK) ([::1]:53)
Stats:
Received 70 B from [::1]:53 in 1ms (04:06:49 08-11-2024 CEST)
Opcode: QUERY Status: NOTIMP ID 7238: Flags: qr rd ra ad (1 Q 0 A 0 N 1 E)