<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc1035 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.1035.xml'>
<!ENTITY rfc2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
<!ENTITY rfc2181 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2181.xml'>
<!ENTITY rfc2671 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2671.xml'>
<!ENTITY rfc3403 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3403.xml'>
<!ENTITY rfc5155 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5155.xml'>
]>
<rfc category="std" ipr="trust200902" docName="draft-bellis-dnsext-multi-qtypes-00">
    <?rfc toc='yes' ?>
    <?rfc tocompact='no' ?>
    <?rfc compact='yes' ?>
    <?rfc subcompact='yes' ?>
    <?rfc sortrefs='yes' ?>
    <?rfc symrefs='yes' ?>
    <front>
        <title>Title</title>
        <author initials="R.P." surname="Bellis" fullname="Ray Bellis">
            <organization>Nominet UK</organization>
            <address>
            <postal>
                <street>Edmund Halley Road</street>
                <city>Oxford</city>
                <code>OX4 4DQ</code>
                <country>United Kingdom</country>
            </postal>
            <phone>+44 1865 332211</phone>
            <email>ray.bellis@nominet.org.uk</email>
            <uri>http://www.nominet.org.uk/</uri>
        </address>
        </author>

        <date year="2012"/>
        <area>Internet Area</area>
        <workgroup/>
        <keyword/>

        <abstract>
            <t> This document specifies a method for a DNS client to request additional DNS record
                types to be delivered alongside the primary record type specified in the question
                section of a DNS query.</t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction" anchor="intro">
            <t> A commonly requested <xref target="RFC1035">DNS</xref> feature is the ability to
                receive multiple related resource records (RRs) in a single DNS response.</t>

            <t> For example, it may be desirable to receive both the A and AAAA records for a domain
                name together, rather than having to issue multiple queries.</t>

            <t> The DNS wire protocol in theory supports having multiple questions in a single
                packet, but in practise this does not work:</t>

            <t>
                <list style="symbols">

                    <t> Each question consists of the tuple (QNAME, QTYPE, QCLASS). Since each
                        question has its own QNAME field it would be possible for one name to exist
                        and another to not exist, resulting in an inconsistent response code.</t>

                    <t> The idea that only a single question is allowed is sufficiently entrenched
                        that many DNS servers will simply return an error (or fail to response at
                        all) if they receive a query with a question count (QDCOUNT) of more than
                        one.</t>

                </list>
            </t>

            <t> To resolve both of these issues, this document constraints the problem to those
                cases where only the QTYPE varies by specifying a new option for the Extension
                Mechanisms for DNS (<xref target="RFC2671">EDNS</xref>) that contains an additional
                list of QTYPE values that the client wishes to receive in addition to that in the
                primary question.</t>

            <t> TODO: why not "ANY" ? </t>

        </section>

        <section anchor="terminology" title="Terminology used in this document">
            <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD
                NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as
                described in <xref target="RFC2119"/>. </t>
        </section>

        <section title="Description" anchor="description">

            <section title="Multiple QTYPE EDNS Option Format" anchor="edns">

                <t> The overall format of an EDNS option is shown for reference below, per <xref
                        target="RFC2671"/>, followed by the option specific data:</t>
                <t>
                    <figure>
                        <artwork align="center">
                            <![CDATA[
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0: |                          OPTION-CODE                          |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2: |                         OPTION-LENGTH                         |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
4: |                                                               |
   /                          OPTION-DATA                          /
   /                                                               /
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
]]>
                        </artwork>
                    </figure>
                </t>

                <t>OPTION-CODE: TBD by IANA</t>

                <t>OPTION-LENGTH: Size (in octets) of OPTION-DATA.</t>

                <t>OPTION-DATA: Option specific, as below:<figure>
                        <artwork align="center">
                            <![CDATA[
                +0 (MSB)                            +1 (LSB)
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
0: |QTD|   reserved    |  QTCOUNT  |           QT1 (MSB)           |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
2: |           QT1 (LSB)           |              ...              |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
   |              ...             ///          QTn (MSB)           |
   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
   |           QTn (LSB)           |
   +---+---+---+---+---+---+---+---+
]]>
                        </artwork>
                    </figure>
                </t>

                <t> QTD: this bit indicates the direction of the packet. It MUST be clear (0) in a
                    query and set (1) in a response.</t>

                <t> QTCOUNT: a 3 bit field with range 0 .. 7 specifying the number of QT fields to
                    follow.</t>

                <t> QTn: a 2 byte field (MSB first) specifying a DNS RR type. The RR type MUST be
                    for a real resource record, and MUST NOT refer to a pseudo RR type such as
                    "OPT", "IXFR", "TSIG", etc. </t>

            </section>

            <section title="Response Generation" anchor="responses">

                <section title="Server Side Processing">
                    <t> A conforming server that receives a Multiple QTYPE Option in a query MUST
                        return a Multiple QTYPE Option in its response.</t>

                    <t> The QTD bit in that response MUST be set (1) as protection against servers
                        which simply echo unknown EDNS options verbatim. If the QTD bit in a
                        response is zero the client MUST treat the response as if this option is
                        unsupported.</t>

                    <t> The server SHOULD attempt to return any resource records known to it that
                        match the additional (QTYPE, QCLASS, QTn) tuples. These records MUST be
                        returned in the Answer Section of the response, but the answer for the
                        primary QTYPE from the Question Section MUST be included first.</t>

                    <t> For any particular QTn in the query, if the server provides addtional
                        answers, or has knowledge that the RR type type does not exist for that
                        QNAME (a "negative answer"), it must include that QTn value in the Multiple
                        QTYPE Option of its response.</t>

                    <t> A negative answer is therefore indicated by the combination of the presence
                        of a QTn value in the Multiple QTYPE Option and the absence of a matching
                        record in the Answer Section. This is necessary (in the absence of DNSSEC)
                        to differentiate between absence of the record from the zone and absence of
                        the record from the response.</t>

                    <t> A server that is authoritative for the specified QNAME on receipt of a
                        Multiple QTYPE Option MUST attempt to return all specified RR types except
                        where that would result in truncation in which case it may omit some (or
                        all) of the records for the additional RR types. Those RR types MUST then
                        also be omitted from the Multiple QTYPE Option in the response.</t>

                    <t> A caching recursive server receiving a Multiple QTYPE Option SHOULD attempt
                        to fill its positive and negative caches with all of the specified RR types
                        before returning its response to the client.</t>

                    <t> TODO: is there a case for mandatory answers, i.e. the client saying I
                        _really_ want all these?</t>

                </section>

                <section title="Client Side Processing">

                    <t> Recursive resolvers MAY use this method to obtain multiple records from an
                        authoritative server. For the purposes of Section 5.4.1 of <xref
                            target="RFC2181"/> any authoritative answers received MUST be ranked the
                        same as the answer for the primary question.</t>

                    <t> </t>
                </section>

                <section title="DNSSEC" anchor="dnssec">
                    <t> If the DNS client sets the "DNSSEC OK" (DO) bit in the query then the server
                        MUST also return the related DNSSEC records that would have been returned in
                        a standalone query for the same QTYPE.</t>

                    <t> A negative answer from a signed zone MUST contain the appropriate
                        authenticated denial of existence records, per <xref target="RFC3403"/> and
                            <xref target="RFC5155"/>.</t>

                    <t> In a signed zone there is a theoretical risk of valid signatures for one RR
                        type and invalid signatures for another. This is the only case known to the
                        author where the response code for any particular QNAME may be inconsistent
                        across different RR types.</t>

                    <t> Should a validating resolver produce NOERROR for some RR types and SERVFAIL
                        for others it MUST omit the RR types that failed to validate from its
                        response and from the QTn fields on the Multiple QTYPE option. The client
                        MAY then initiate standalone queries for those RR types.</t>
                </section>

            </section>

        </section>

        <section title="Security Considerations" anchor="security">
            <t> The method documented here does not change any of the security properties of the DNS
                protocol itself.</t>

            <t> It should however be noted that this method does increase the potential
                amplification factor when the DNS protocol is used as a vector for a denial of
                service attack.</t>
        </section>

        <section title="IANA Considerations" anchor="iana">
            <t> IANA is requested to assign a new value in the DNS EDNS0 Options registry.</t>
        </section>

        <section title="Acknowledgements">
            <t> The author wishes to thank the following for their feedback and reviews during the
                initial development of this document: Michael Graff, Olafur Gudmundsson, Matthijs
                Mekking, Paul Vixie.</t>
        </section>

    </middle>

    <back>
        <references title="Normative References"> &rfc1035; &rfc2119; &rfc2181;
            &rfc2671; &rfc3403; &rfc5155; </references>

        <!-- <references title="Informative References">
	</references> -->

        <section title="Change Log" anchor="changelog">

            <t>NB: to be removed by the RFC Editor before publication.</t>

            <t>draft-bellis-dnsext-multi-qtypes-00<list>
                    <t>Initial draft</t>
                </list>
            </t>
        </section>

    </back>
</rfc>
