]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
kr_pkt_text: OPT RR does not need to be at the end of Additional section
authorPetr Špaček <petr.spacek@nic.cz>
Fri, 31 Jul 2020 15:52:50 +0000 (17:52 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Mon, 3 Aug 2020 09:43:50 +0000 (11:43 +0200)
Previous code incorrectly assumed that OPT was last RR in section
and this lead to truncating output.
https://tools.ietf.org/html/rfc6891#section-6.1.1 clearly states that
OPT can be anywhere in Additional section.

Printer relies on checks in libknot packet parser: check_rr_constraints()
prevents packets with more OPT RRs or OPT outside of additional section
from being parsed so the printer cannot see them.

lib/utils.c

index 2be3ca60bc6fb9b233286a66f01eb602854c132b..fcba71bb0cb19f0a6d1f03e67ce704dbfbea18f7 100644 (file)
@@ -1056,8 +1056,7 @@ char *kr_pkt_text(const knot_pkt_t *pkt)
 
        for (knot_section_t i = KNOT_ANSWER; i <= KNOT_ADDITIONAL; ++i) {
                const knot_pktsection_t *sec = knot_pkt_section(pkt, i);
-               if (sec->count == 0 || knot_pkt_rr(sec, 0)->type == KNOT_RRTYPE_OPT) {
-                       /* OPT RRs are _supposed_ to be the last ^^, if they appear */
+               if (sec->count == 0) {
                        continue;
                }