From: Petr Špaček Date: Fri, 31 Jul 2020 15:52:50 +0000 (+0200) Subject: kr_pkt_text: OPT RR does not need to be at the end of Additional section X-Git-Tag: v5.1.3~21^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3242564129f91f02ec29d74b54693459ac23838c;p=thirdparty%2Fknot-resolver.git kr_pkt_text: OPT RR does not need to be at the end of Additional section 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. --- diff --git a/lib/utils.c b/lib/utils.c index 2be3ca60b..fcba71bb0 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -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; }