<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.30 (Ruby 3.4.7) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-jabley-dnsop-ordered-answer-section-00" category="std" consensus="true" submissionType="IETF" updates="10341035" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.31.0 -->
  <front>
    <title>Ordering of RRSets in DNS Message Sections</title>
    <seriesInfo name="Internet-Draft" value="draft-jabley-dnsop-ordered-answer-section-00"/>
    <author fullname="Joe Abley">
      <organization>Cloudflare</organization>
      <address>
        <email>jabley@cloudflare.com</email>
      </address>
    </author>
    <author fullname="Sebastiaan Neuteboom">
      <organization>Cloudflare</organization>
      <address>
        <email>sebastiaan@cloudflare.com</email>
      </address>
    </author>
    <date year="2026" month="January" day="14"/>
    <area>Operations and Management</area>
    <workgroup>Domain Name System Operations</workgroup>
    <keyword>dns</keyword>
    <keyword>dns protocol</keyword>
    <keyword>dns message</keyword>
    <abstract>
      <?line 58?>

<t>The existing Domain Name System (DNS) specifications lack some
clarity in their description of the process by which individual
sections of a DNS message are constructed.</t>
      <t>This document updates RFC 1034 and RFC 1035 to provide a clearer
specification, consistent with deployed implementations.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://ableyjoe.github.io/draft-jabley-dnsop-ordered-answer-section/draft-jabley-dnsop-ordered-answer-section.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-jabley-dnsop-ordered-answer-section/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        Domain Name System Operations Working Group mailing list (<eref target="mailto:dnsop@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/dnsop/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/dnsop/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/ableyjoe/draft-jabley-dnsop-ordered-answer-section"/>.</t>
    </note>
  </front>
  <middle>
    <?line 68?>

<section anchor="introduction">
      <name>Introduction</name>
      <t><xref target="RFC1034"/> specifies an algorithm to follow when constructing
a response to a DNS QUERY.  This algorithm in some cases can result
in multiple RRSets being included in a single section of a DNS
message, e.g. when handling CNAME resource records.</t>
      <t>Most consumers of DNS responses, such as stub resolvers, have interpreted the
direction to copy or store particular RRSets in sections of a DNS
response to mean "append", treating each section as an ordered list
of RRSets.  In particular, many stub stub resolvers are known to rely upon
that interpretation when processing DNS responses, e.g. see <xref target="cloudflare"/>.</t>
      <t>Some DNS implementations employ algorithms in other sections that aim
to optimise processing of responses received by initiators, e.g.
NAPTR before SRV before A/AAAA in the additional section of a
response.  This behaviour has not been observed to cause any
interoperability problems, and is explicitly permitted by this
document.</t>
      <t>This document updates <xref target="RFC1035"/> to specify that the answer section in a
DNS message is an ordered list of RRSets, but that other sections may be
ordered differently. This document clarifies the directions
provided in <xref target="RFC1034"/> to match the observed behaviour and
expectations of deployed software.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

<t>This document assumes familiarity with terminology specific to the Domain Name System
(DNS) as described in <xref target="RFC9499"/>.</t>
    </section>
    <section anchor="rfc1034_updates">
      <name>Updates to RFC 1034</name>
      <t><xref target="RFC1034"/> specifies the algorithms by which sections of a DNS
response are constructed.  For example, step 3 of the
algorithm described in <xref target="RFC1034"/> section 4.3.2 contains the direction
"copy all RRs which match QTYPE into answer section".</t>
      <t>In this case, and in all other cases where <xref target="RFC1034"/> specifies that
particular RRSets be included in the answer section of a DNS message, the
section <bcp14>MUST</bcp14> be treated as an ordered list of RRSets.  When it is
necessary to include new RRSets in a section of a DNS message that is
under construction, those RRSets <bcp14>MUST</bcp14> be appended. The receiver of a
DNS message <bcp14>MAY</bcp14> refuse to process DNS messages that have been constructed
differently.</t>
      <t>When constructing other sections of a DNS message, each section <bcp14>MAY</bcp14> be
treated as a non-ordered list. A receiver of a DNS message <bcp14>MUST NOT</bcp14>
reject a DNS message on the basis of the order of RRSets in those sections.</t>
    </section>
    <section anchor="rfc1035_updates">
      <name>Updates to RFC 1035</name>
      <t>In a DNS message, the answer section <bcp14>MUST</bcp14> be considered to be an ordered
set of RRSets. All other sections in a DNS message <bcp14>MUST</bcp14> be considered to
be a non-ordered set.</t>
      <t>DNS implementations <bcp14>MUST</bcp14> construct each section in a DNS response
according to the algorithms specified in <xref target="RFC1034"/>, as clarified in
<xref target="rfc1034_updates"/>.</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>The recommendations contained in this document have no known security
implications.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-combined-references">
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>
        <reference anchor="RFC1034">
          <front>
            <title>Domain names - concepts and facilities</title>
            <author fullname="P. Mockapetris" initials="P." surname="Mockapetris"/>
            <date month="November" year="1987"/>
            <abstract>
              <t>This RFC is the revised basic definition of The Domain Name System. It obsoletes RFC-882. This memo describes the domain style names and their used for host address look up and electronic mail forwarding. It discusses the clients and servers in the domain name system and the protocol used between them.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="13"/>
          <seriesInfo name="RFC" value="1034"/>
          <seriesInfo name="DOI" value="10.17487/RFC1034"/>
        </reference>
        <reference anchor="RFC1035">
          <front>
            <title>Domain names - implementation and specification</title>
            <author fullname="P. Mockapetris" initials="P." surname="Mockapetris"/>
            <date month="November" year="1987"/>
            <abstract>
              <t>This RFC is the revised specification of the protocol and format used in the implementation of the Domain Name System. It obsoletes RFC-883. This memo documents the details of the domain name client - server communication.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="13"/>
          <seriesInfo name="RFC" value="1035"/>
          <seriesInfo name="DOI" value="10.17487/RFC1035"/>
        </reference>
        <reference anchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
            <abstract>
              <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="RFC9499">
          <front>
            <title>DNS Terminology</title>
            <author fullname="P. Hoffman" initials="P." surname="Hoffman"/>
            <author fullname="K. Fujiwara" initials="K." surname="Fujiwara"/>
            <date month="March" year="2024"/>
            <abstract>
              <t>The Domain Name System (DNS) is defined in literally dozens of different RFCs. The terminology used by implementers and developers of DNS protocols, and by operators of DNS systems, has changed in the decades since the DNS was first defined. This document gives current definitions for many of the terms used in the DNS in a single document.</t>
              <t>This document updates RFC 2308 by clarifying the definitions of "forwarder" and "QNAME". It obsoletes RFC 8499 by adding multiple terms and clarifications. Comprehensive lists of changed and new definitions can be found in Appendices A and B.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="219"/>
          <seriesInfo name="RFC" value="9499"/>
          <seriesInfo name="DOI" value="10.17487/RFC9499"/>
        </reference>
      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>
        <reference anchor="Neuteboom2026" target="https://blog.cloudflare.com/cname-a-record-order-dns-standards/">
          <front>
            <title>What came first: the CNAME or the A record?</title>
            <author initials="S." surname="Neuteboom" fullname="Sebastiaan Neuteboom">
              <organization>Cloudflare</organization>
            </author>
            <date year="2026" month="January" day="14"/>
          </front>
        </reference>
        <reference anchor="Cisco2026" target="https://www.cisco.com/c/en/us/support/docs/smb/switches/Catalyst-switches/kmgmt3846-cbs-reboot-with-fatal-error-from-dnsc-process.html">
          <front>
            <title>Cisco Business Switches Reboot with Fatal Error from DNSC Process</title>
            <author>
              <organization>Cisco</organization>
            </author>
            <date year="2026" month="January" day="08"/>
          </front>
        </reference>
      </references>
    </references>
    <?line 165?>

<section anchor="cloudflare">
      <name>Events of 8 January 2026</name>
      <t>Cloudflare operates a well-known public DNS resolver known as
1.1.1.1, after one of the IPv4 addresses associated with the service.
On 8 January a software change in the 1.1.1.1 service had the
unintential side-effect of changing the order in which RRSets were
encoded in the answer section of DNS responses, in the case where
constructing the responses involved CNAME processing. The previous
ordering was as clarified in <xref target="rfc1034_updates"/> and <xref target="rfc1035_updates"/>. The change in behaviour
was not detected by a corresponding failure in a regression test,
since the ordering in the answer section was not considered to be
significant.</t>
      <t>Following the software release, Cloudflare became aware of significant
numbers of deployed DNS client implementations that were suffering
from failure. In particular, the getanswer_r() function invoked by
the getaddrinfo() function in glibc was found to fail to function,
and some deployed ethernet switches were observed to reboot when
trying to resolve the names of configured NTP servers <xref target="Cisco2026"/>.</t>
      <t>The impact associated with this event was particularly widespread
because of the widespread use of the 1.1.1.1 resolver. However, the
two examples of client implementations are also widely deployed in
systems that may well be upgraded only infrequently (or never
upgraded at all).</t>
      <t>See <xref target="Neuteboom2026"/> for additional information.</t>
    </section>
    <section anchor="editorial-notes-remove-before-publication">
      <name>Editorial Notes (remove before publication)</name>
      <section anchor="draft-jabley-dnsop-ordered-sections-00">
        <name>draft-jabley-dnsop-ordered-sections-00</name>
        <t>Initial draft circulated for comment in 2015; subsequently expired.</t>
      </section>
      <section anchor="draft-jabley-dnsop-ordered-answer-section-00">
        <name>draft-jabley-dnsop-ordered-answer-section-00</name>
        <t>Draft revitalised following some operational excitement.</t>
        <t>Added competent co-author.</t>
      </section>
    </section>
    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>The contributions of Mark Andrews and Paul Vixie to the original
revision of this document are acknowledged.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA41Zf3PbuBH9H58CVf5JOqYUJbaTuNe709lOzzfxj9jOZTKd
zg1EQhLOFKECoBXVk+/Sz9JP1rcLkKJkJRNnJhJJENh9+/btAsqyTAQTSn0k
e5eu0M5UU2kn8vr6RgcvTSVPLm7kufZeTbW80XkwtvI9kaugp9atjqQPhagX
Ba79kRw+f7m/h/8OhChsXqk55i2cmoTsTzUu9SorKm8XmaWVdJGpyi+1y3yc
Nnv+XPh6PDfe4yqsFnj57PT2rZRPpCq9hYmmKvRC478q9PZkTxcmWGdUSRdn
o1/wYR2+Xd++7Ymqno+1OxJk2pHIYbaufA0jg6u1uD+SL4VyWpHjC+0UOyZV
VchzVcHZOa0hltbdTZ2tFxh2YucKgFzAK3mz8kHP5frNnrj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