<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-dprive-dnsoquic-11" category="std" obsoletes="" number="9250" updates="" submissionType="IETF" xml:lang="en" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" version="3">


  <front>
    <title abbrev="DNS over Dedicated QUIC">DNS over Dedicated QUIC Connections</title>
    <seriesInfo name="RFC" value="9250"/>
    <author initials="C" surname="Huitema" fullname="Christian Huitema">
      <organization>Private Octopus Inc.</organization>
      <address>
        <postal>
          <street>427 Golfcourse Rd</street>
          <city>Friday Harbor</city>
          <code>WA 98250</code>
          <country>USA</country>
        </postal>
        <email>huitema@huitema.net</email>
      </address>
    </author>
    <author initials="S." surname="Dickinson" fullname="Sara Dickinson">
      <organization>Sinodun IT</organization>
      <address>
        <postal>
          <street>Oxford Science Park</street>
          <city>Oxford</city>
          <code>OX4 4GA</code>
          <country>United Kingdom</country>
        </postal>
        <email>sara@sinodun.com</email>
      </address>
    </author>
    <author initials="A." surname="Mankin" fullname="Allison Mankin">
      <organization>Salesforce</organization>
      <address>
        <email>allison.mankin@gmail.com</email>
      </address>
    </author>
    <date year="2022" month="May"/>
    <area>Internet</area>
    <workgroup>DNS PRIVate Exchange</workgroup>

<keyword>DNS</keyword>
<keyword>QUIC</keyword>
<keyword>DNS over QUIC</keyword>
<keyword>Encrypted DNS</keyword>
<keyword>DoQ</keyword>
    
    <abstract>
      <t>This document describes the use of QUIC to provide transport confidentiality for DNS.
The encryption provided by QUIC has similar properties to those provided by TLS,
while QUIC transport eliminates the head-of-line blocking issues inherent with
TCP and provides more efficient packet-loss recovery than UDP. DNS over QUIC
(DoQ) has privacy properties similar to DNS over TLS (DoT) specified in
RFC 7858, and latency characteristics similar to classic DNS over UDP. This
specification describes the use of DoQ as a general-purpose transport
for DNS and includes the use of DoQ for stub to recursive,
recursive to authoritative, and zone transfer scenarios.</t>
    </abstract>

  </front>

  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>Domain Name System (DNS) concepts are specified in "Domain names - concepts and
facilities" <xref target="RFC1034" format="default"/>. The transmission of DNS queries and responses over
UDP and TCP is specified in "Domain names - implementation and specification"
<xref target="RFC1035" format="default"/>.</t>
      <t>This document presents a mapping of the DNS protocol over the
QUIC transport <xref target="RFC9000" format="default"/> <xref target="RFC9001" format="default"/>. DNS over QUIC is referred to here as DoQ,
in line with "DNS Terminology" <xref target="I-D.ietf-dnsop-rfc8499bis" format="default"/>.</t>
      <t>The goals of the DoQ mapping are:</t>
      <ol spacing="normal" type="1"><li>Provide the same DNS privacy protection as DoT
<xref target="RFC7858" format="default"/>. This includes an option for the client to
authenticate the server by means of an authentication domain
name as specified in "Usage Profiles for DNS over TLS and DNS
over DTLS" <xref target="RFC8310" format="default"/>.</li>
        <li>Provide an improved level of source address validation for DNS
servers compared to classic DNS over UDP.</li>
        <li>Provide a transport that does not impose path MTU limitations on the
size of DNS responses it can send.</li>
      </ol>
      <t>In order to achieve these goals, and to support ongoing work on encryption of
DNS, the scope of this document includes:</t>

      <ul spacing="normal">
        <li>the "stub to recursive resolver" scenario (also called the "stub to recursive" scenario in this document)</li>
        <li>the "recursive resolver to authoritative nameserver" scenario (also called the “recursive to authoritative” scenario in this document), and</li>
        <li>the "nameserver to nameserver" scenario (mainly used for zone transfers (XFR) <xref target="RFC1995" format="default"/> <xref target="RFC5936" format="default"/>).</li>
      </ul>
      <t>In other words, this document specifies QUIC as a general-purpose
transport for DNS.</t>
      <t>The specific non-goals of this document are:</t>
      <ol spacing="normal" type="1"><li>No attempt is made to evade potential blocking of DoQ
traffic by middleboxes.</li>
        <li>No attempt to support server-initiated transactions, which are used only in
DNS Stateful Operations (DSO) <xref target="RFC8490" format="default"/>.</li>
      </ol>
      <t>Specifying the transmission of an application over QUIC requires specifying how
the application's messages are mapped to QUIC streams, and generally how the
application will use QUIC. This is done for HTTP in "Hypertext Transfer
Protocol Version 3 (HTTP/3)" <xref target="I-D.ietf-quic-http" format="default"/>. The purpose of this
document is to define the way DNS messages can be transmitted over QUIC.</t>


<t>DNS over HTTPS (DoH) <xref target="RFC8484" format="default"/> can be used with HTTP/3 to get some of the
benefits of QUIC. However, a lightweight direct mapping for DoQ can
be regarded as a more natural fit for both the recursive to authoritative and
zone transfer scenarios, which rarely involve intermediaries. In these
scenarios, the additional overhead of HTTP is not offset by, for example, benefits of
HTTP proxying and caching behavior.</t>
      <t>In this document, <xref target="design-considerations" format="default"/> presents the reasoning that guided
the proposed design. <xref target="specifications" format="default"/> specifies the actual mapping of DoQ.
<xref target="implementation-requirements" format="default"/> presents guidelines on the implementation,
usage, and deployment of DoQ.</t>
    </section>
    <section anchor="key-words" numbered="true" toc="default">
      <name>Key Words</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&nbsp;14 <xref target="RFC2119"/>
    <xref target="RFC8174"/> when, and only when, they appear in all capitals,
    as shown here.
        </t>

    </section>

    <section anchor="design-considerations" numbered="true" toc="default">
      <name>Design Considerations</name>
      <t>This section and its subsections present the design guidelines that were used
for DoQ. While all other sections in this document are normative, this section
is informative in nature.</t>
      <section anchor="provide-dns-privacy" numbered="true" toc="default">
        <name>Provide DNS Privacy</name>
        <t>DoT <xref target="RFC7858" format="default"/> defines how to mitigate some of the issues described in "DNS
Privacy Considerations" <xref target="RFC9076" format="default"/> by specifying how to transmit DNS messages
over TLS. The "Usage Profiles for DNS over TLS and DNS over DTLS" <xref target="RFC8310" format="default"/>
specify Strict and Opportunistic usage profiles for DoT including how stub
resolvers can authenticate recursive resolvers.</t>


<t>QUIC connection setup includes the negotiation of security parameters using
TLS, as specified in "Using TLS to Secure QUIC" <xref target="RFC9001" format="default"/>,
enabling encryption of the QUIC transport. Transmitting DNS messages over QUIC
will provide essentially the same privacy protections as DoT <xref target="RFC7858" format="default"/>
including Strict and Opportunistic usage profiles <xref target="RFC8310" format="default"/>. Further
discussion on this is provided in <xref target="privacy-considerations" format="default"/>.</t>
      </section>
      <section anchor="design-for-minimum-latency" numbered="true" toc="default">
        <name>Design for Minimum Latency</name>
        <t>QUIC is specifically designed to reduce protocol-induced delays, with features
such as:</t>
        <ol spacing="normal" type="1"><li>Support for 0-RTT data during session resumption.</li>
          <li>Support for advanced packet-loss recovery procedures as specified in
"QUIC Loss Detection and Congestion Control" <xref target="RFC9002" format="default"/>.</li>
          <li>Mitigation of head-of-line blocking by allowing parallel
delivery of data on multiple streams.</li>
        </ol>
        <t>This mapping of DNS to QUIC will take advantage of these features in
three ways:</t>
        <ol spacing="normal" type="1"><li>Optional support for sending 0-RTT data during session resumption
(the security and privacy implications of this are discussed
in later sections).</li>
          <li>Long-lived QUIC connections over which multiple DNS transactions
are performed,
generating the sustained traffic required to benefit from
advanced recovery features.</li>
          <li>Mapping of each DNS Query/Response transaction to a separate stream,
to mitigate head-of-line blocking. This enables servers to respond
to queries "out of order". It also enables clients to process
responses as soon as they arrive, without having to wait for in-order delivery of responses previously posted by the server.</li>
        </ol>
        <t>These considerations are reflected in the mapping of DNS traffic
to QUIC streams in <xref target="stream-mapping-and-usage" format="default"/>.</t>
      </section>
      <section anchor="middlebox-considerations" numbered="true" toc="default">
        <name>Middlebox Considerations</name>
        <t>Using QUIC might allow a protocol to disguise its purpose from devices on the
network path using encryption and traffic analysis resistance techniques like
padding, traffic pacing, and traffic shaping. This specification does not
include any measures that are designed to avoid such classification;
the padding mechanisms defined in <xref target="padding" format="default"/> are intended to obfuscate the specific
records contained in DNS queries and responses, but not the fact that this is DNS traffic.
Consequently, firewalls and other middleboxes might
be able to distinguish DoQ from other protocols that use QUIC, like HTTP, and
apply different treatment.</t>
        <t>The lack of measures in this specification to avoid protocol classification is 
not an endorsement of such practices.</t>
      </section>
      <section anchor="no-server-initiated-transactions" numbered="true" toc="default">
        <name>No Server-Initiated Transactions</name>
        <t>As stated in <xref target="introduction" format="default"/>, this document does not specify support for
server-initiated transactions within established DoQ connections. That is, only
the initiator of the DoQ connection may send queries over the connection.</t>
        <t>DSO does support server-initiated transactions within existing connections.
However, DoQ as defined here does not meet the criteria for an applicable
transport for DSO because it does not guarantee in-order delivery of messages;
see <xref section="4.2" sectionFormat="of" target="RFC8490" format="default"/>.</t>
      </section>
    </section>
    <section anchor="specifications" numbered="true" toc="default">
      <name>Specifications</name>
      <section anchor="connection-establishment" numbered="true" toc="default">
        <name>Connection Establishment</name>
        <t>DoQ connections are established as described in the QUIC transport
specification <xref target="RFC9000" format="default"/>. During connection establishment, DoQ support is
indicated by selecting the Application-Layer Protocol Negotiation (ALPN) token "doq" in the crypto handshake.</t>

        <section anchor="port-selection" numbered="true" toc="default">
          <name>Port Selection</name>
          <t>By default, a DNS server that supports DoQ <bcp14>MUST</bcp14> listen for and accept QUIC
connections on the dedicated UDP port 853 (<xref target="iana-considerations" format="default"/>), unless there is a mutual agreement to
use another port.</t>
          <t>By default, a DNS client desiring to use DoQ with a particular server <bcp14>MUST</bcp14>
establish a QUIC connection to UDP port 853 on the server, unless there is a
mutual agreement to use another port.</t>
          <t>DoQ connections <bcp14>MUST NOT</bcp14> use UDP port 53. This recommendation against use of
port 53 for DoQ is to avoid confusion between DoQ and the use of DNS over UDP
<xref target="RFC1035" format="default"/>. The risk of confusion exists even if two parties agreed on
port 53, as other parties without knowledge of that agreement might still
try to use that port.</t>

<t>In the stub to recursive scenario, the use of port 443 as a mutually agreed
alternative port can be operationally beneficial, since port 443 is 
used by many services using QUIC and HTTP-3 and is thus less likely
to be blocked than other ports. Several mechanisms for stubs to discover
recursives offering encrypted transports, including the use of custom ports, are
the subject of ongoing work.</t>
        </section>
      </section>


      <section anchor="stream-mapping-and-usage" numbered="true" toc="default">
        <name>Stream Mapping and Usage</name>
        <t>The mapping of DNS traffic over QUIC streams takes advantage of the QUIC stream
features detailed in <xref section="2" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport specification.</t>
        <t>DNS query/response traffic <xref target="RFC1034" format="default"/> <xref target="RFC1035" format="default"/>
follows a simple pattern in which the client sends a query, and the
server provides one or more responses (multiple responses can occur in zone
transfers).</t>
        <t>The mapping specified here requires that the client select a separate QUIC
stream for each query. The server then uses the same stream to provide all the
response messages for that query. In order for multiple responses to be
parsed, a 2-octet length field is used in exactly the same way as the 2-octet
length field defined for DNS over TCP <xref target="RFC1035" format="default"/>. The practical result of this
is that the content of each QUIC stream is exactly the same as the content of a
TCP connection that would manage exactly one query.</t>
        <t>All DNS messages (queries and responses) sent over DoQ connections <bcp14>MUST</bcp14> be
encoded as a 2-octet length field followed by the message content as specified
in <xref target="RFC1035" format="default"/>.</t>
        <t>The client <bcp14>MUST</bcp14> select the next available client-initiated bidirectional stream
for each subsequent query on a QUIC connection, in conformance with the QUIC
transport specification <xref target="RFC9000" format="default"/>. Packet losses and other network events might
cause queries to arrive in a different order. Servers <bcp14>SHOULD</bcp14> process queries
as they arrive, as not doing so would cause unnecessary delays.</t>
        <t>The client <bcp14>MUST</bcp14> send the DNS query over the selected stream and <bcp14>MUST</bcp14> indicate
through the STREAM FIN mechanism that no further data will be sent on that
stream.</t>
        <t>The server <bcp14>MUST</bcp14> send the response(s) on the same stream and <bcp14>MUST</bcp14> indicate, after
the last response, through the STREAM FIN mechanism that no further data will be
sent on that stream.</t>
        <t>Therefore, a single DNS transaction consumes a single bidirectional client-initiated stream.
This means that the client's first query occurs on QUIC stream 0, the second on
4, and so on (see <xref section="2.1" sectionFormat="of" target="RFC9000" format="default"/>).</t>
        <t>Servers <bcp14>MAY</bcp14> defer processing of a query until the STREAM FIN has been indicated
on the stream selected by the client.</t>
        <t>Servers and clients <bcp14>MAY</bcp14> monitor the number
of "dangling" streams. These are open streams where the following events have not 
occurred after implementation-defined timeouts:</t>
        <ul spacing="normal">
          <li>the expected queries or responses have not been received or,</li>
          <li>the expected queries or responses have been received but not the STREAM FIN</li>
        </ul>
        <t>Implementations <bcp14>MAY</bcp14> impose a limit on the number of
	such dangling streams. If limits are encountered, implementations <bcp14>MAY</bcp14> close the connection.</t>

        <section anchor="dns-message-ids" numbered="true" toc="default">
          <name>DNS Message IDs</name>
          <t>When sending queries over a QUIC connection, the DNS Message ID <bcp14>MUST</bcp14> be set to
0. The stream mapping for DoQ allows for unambiguous correlation of queries
and responses, so the Message ID field is not required.</t>
          <t>This has implications for proxying DoQ messages to and from other transports.
For example, proxies may have to manage the fact that DoQ can support a larger
number of outstanding queries on a single connection than, for example, DNS over TCP,
because DoQ is not limited by the Message ID space. This issue already exists for DoH,
where a Message ID of 0 is recommended.</t>
          <t>When forwarding a DNS message from DoQ over another transport, a DNS Message ID
<bcp14>MUST</bcp14> be generated according to the rules of the protocol that is in use. When
forwarding a DNS message from another transport over DoQ, the Message ID <bcp14>MUST</bcp14>
be set to 0.</t>
        </section>
      </section>
      <section anchor="doq-error-codes" numbered="true" toc="default">
        <name>DoQ Error Codes</name>
        <t>The following error codes are defined for use when abruptly terminating streams,
for use as application protocol error codes when
aborting reading of streams, or for immediately closing connections:</t>
        <dl>
          <dt>
DOQ_NO_ERROR (0x0):  </dt>
          <dd>
            <t>No error.  This is used when the connection or stream needs to be closed, but
there is no error to signal.</t>
          </dd>
          <dt>
DOQ_INTERNAL_ERROR (0x1):  </dt>
          <dd>
            <t>The DoQ implementation encountered an internal error and is incapable of
pursuing the transaction or the connection.</t>
          </dd>
          <dt>
DOQ_PROTOCOL_ERROR (0x2):  </dt>
          <dd>
            <t>The DoQ implementation encountered a protocol error and is forcibly aborting
the connection.</t>
          </dd>
          <dt>
DOQ_REQUEST_CANCELLED (0x3):  </dt>
          <dd>
            <t>A DoQ client uses this to signal that it wants to cancel an
outstanding transaction.</t>
          </dd>
          <dt>
DOQ_EXCESSIVE_LOAD (0x4):  </dt>
          <dd>
            <t>A DoQ implementation uses this to signal when closing a connection due to excessive load.</t>
          </dd>
          <dt>
DOQ_UNSPECIFIED_ERROR (0x5):  </dt>
          <dd>
            <t>A DoQ implementation uses this in the absence of a more specific error code.</t>
          </dd>
          <dt>
DOQ_ERROR_RESERVED (0xd098ea5e):  </dt>
          <dd>
            <t>An alternative error code used for tests.</t>
          </dd>
        </dl>
        <t>See <xref target="iana-error-codes" format="default"/> for details on registering new error codes.</t>
        <section anchor="transaction-cancellation" numbered="true" toc="default">
          <name>Transaction Cancellation</name>
          <t>In QUIC, sending STOP_SENDING requests that a peer cease transmission on a
stream. If a DoQ client wishes to cancel an outstanding request, it <bcp14>MUST</bcp14> issue
a QUIC STOP_SENDING, and it <bcp14>SHOULD</bcp14> use the error code DOQ_REQUEST_CANCELLED.
It <bcp14>MAY</bcp14> use a more specific error code registered according to <xref target="iana-error-codes" format="default"/>.
The STOP_SENDING request may be sent at
any time but will have no effect if the server response has already been
sent, in which case the client will simply discard the incoming response.
The corresponding DNS transaction <bcp14>MUST</bcp14> be abandoned.</t>
          <t>Servers that receive STOP_SENDING act in accordance with <xref section="3.5" sectionFormat="of" target="RFC9000" format="default"/>. 
Servers <bcp14>SHOULD NOT</bcp14> continue processing a DNS transaction if they receive a STOP_SENDING.</t>
          <t>Servers <bcp14>MAY</bcp14> impose implementation limits on the total number or rate of cancellation requests.
If limits are encountered, servers <bcp14>MAY</bcp14> close the connection. In this case,
servers wanting to help client debugging <bcp14>MAY</bcp14> use the error code DOQ_EXCESSIVE_LOAD.
There is always a trade-off between helping good faith clients debug issues
and allowing denial-of-service attackers to test server defenses; depending
on circumstances servers might very well choose to send different error codes.</t>
          <t>Note that this mechanism provides a way for secondaries to cancel a single zone
transfer occurring on a given stream without having to close the QUIC
connection.</t>
          <t>Servers <bcp14>MUST NOT</bcp14> continue processing a DNS transaction if they receive a RESET_STREAM
request from the client before the client indicates the STREAM FIN. The server <bcp14>MUST</bcp14>
issue a RESET_STREAM to indicate that the transaction is abandoned unless:</t>
          <ul spacing="normal">
            <li>it has already done so for another reason or</li>
            <li>it has already both sent the response and indicated the STREAM FIN.</li>
          </ul>
        </section>
        <section anchor="transaction-errors" numbered="true" toc="default">
          <name>Transaction Errors</name>
          <t>Servers normally complete transactions by sending a DNS response (or responses)
on the transaction's stream, including cases where the DNS response indicates a
DNS error. 

For example, a client <bcp14>SHOULD</bcp14> be notified of a Server Failure
(SERVFAIL, <xref target="RFC1035"/>) through a response with the Response Code set to
SERVFAIL.

</t>
          <t>If a server is incapable of sending a DNS response due to an internal error, it
<bcp14>SHOULD</bcp14> issue a QUIC RESET_STREAM frame. The error code <bcp14>SHOULD</bcp14> be set to DOQ_INTERNAL_ERROR. The
corresponding DNS transaction <bcp14>MUST</bcp14> be abandoned. Clients <bcp14>MAY</bcp14> limit the number of
unsolicited QUIC RESET_STREAM frames received on a connection before choosing to close the
	  connection.</t>

	  
          <t>Note that this mechanism provides a way for primaries to abort a single zone
transfer occurring on a given stream without having to close the QUIC
connection.</t>
        </section>
        <section anchor="protocol-errors" numbered="true" toc="default">
          <name>Protocol Errors</name>
          <t>Other error scenarios can occur due to malformed, incomplete, or unexpected
messages during a transaction. These include (but are not limited to):</t>
          <ul spacing="normal">
            <li>a client or server receives a message with a non-zero Message ID</li>
            <li>a client or server receives a STREAM FIN before receiving all the bytes for a
message indicated in the 2-octet length field</li>
            <li>a client receives a STREAM FIN before receiving all the expected responses</li>
            <li>a server receives more than one query on a stream</li>
            <li>a client receives a different number of responses on a stream than expected
(e.g., multiple responses to a query for an A record)</li>
            <li>a client receives a STOP_SENDING request</li>
            <li>the client or server does not indicate the expected STREAM FIN after
sending requests or responses (see <xref target="stream-mapping-and-usage" format="default"/>)</li>
            <li>an implementation receives a message containing the edns-tcp-keepalive
EDNS(0) Option <xref target="RFC7828" format="default"/> (see
<xref target="resource-management" format="default"/>)</li>
            <li>a client or a server attempts to open a unidirectional QUIC stream</li>
            <li>a server attempts to open a server-initiated bidirectional QUIC stream</li>

<li>a server receives a "replayable" transaction in 0-RTT data (for servers not willing to          
 handle this case, see <xref target="session-resumption-and-0-rtt" format="default"/>)
</li>

          </ul>
          <t>If a peer encounters such an error condition, it is considered a fatal error. It
<bcp14>SHOULD</bcp14> forcibly abort the connection using QUIC's CONNECTION_CLOSE mechanism
and <bcp14>SHOULD</bcp14> use the DoQ error code DOQ_PROTOCOL_ERROR. In some cases, it <bcp14>MAY</bcp14>
instead silently abandon the connection, which uses fewer of the local resources
but makes debugging at the offending node more difficult.</t>
          <t>It is noted that the restrictions on use of the above EDNS(0) option has
implications for proxying messages from TCP/DoT/DoH over DoQ.</t>
        </section>
        <section anchor="alternative-error-codes" numbered="true" toc="default">
          <name>Alternative Error Codes</name>
          <t>This specification describes specific error codes in Sections <xref target="transaction-cancellation" format="counter"/>,
<xref target="transaction-errors" format="counter"/>, and <xref target="protocol-errors"  format="counter"/>. These error codes are meant
to facilitate investigation of failures and other incidents. New error
codes may be defined in future versions of DoQ or registered as specified
in <xref target="iana-error-codes" format="default"/>.</t>
          <t>Because new error codes can be defined without negotiation, use of an error
code in an unexpected context or receipt of an unknown error code <bcp14>MUST</bcp14> be
treated as equivalent to DOQ_UNSPECIFIED_ERROR.</t>
          <t>Implementations <bcp14>MAY</bcp14> wish to test the support for the error code extension
mechanism by using error codes not listed in this document, or they <bcp14>MAY</bcp14> use
DOQ_ERROR_RESERVED.</t>
        </section>
      </section>



      <section anchor="connection-management" numbered="true" toc="default">
        <name>Connection Management</name>
        <t><xref section="10" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport specification, specifies that
connections can be closed in three ways:</t>
        <ul spacing="normal">
          <li>idle timeout</li>
          <li>immediate close</li>
          <li>stateless reset</li>
        </ul>
        <t>Clients and servers implementing DoQ <bcp14>SHOULD</bcp14> negotiate use of the idle timeout.
Closing on idle timeout is done without any packet exchange, which minimizes
protocol overhead. Per <xref section="10.1" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport specification, the
effective value of the idle timeout is computed as the minimum of the values
advertised by the two endpoints. Practical considerations on setting the idle
timeout are discussed in <xref target="resource-management" format="default"/>.</t>
        <t>Clients <bcp14>SHOULD</bcp14> monitor the idle time incurred on their connection to the
server, defined by the time spent since the last packet from the server has
been received. When a client prepares to send a new DNS query to the server, it
<bcp14>SHOULD</bcp14> check whether the idle time is sufficiently lower than the idle timer. If it
is, the client <bcp14>SHOULD</bcp14> send the DNS query over the existing connection. If not,
the client <bcp14>SHOULD</bcp14> establish a new connection and send the query over that
connection.</t>
        <t>Clients <bcp14>MAY</bcp14> discard their connections to the server before the idle timeout
expires. A client that has outstanding queries <bcp14>SHOULD</bcp14> close the connection
explicitly using QUIC's CONNECTION_CLOSE mechanism and the DoQ error code
DOQ_NO_ERROR.</t>
        <t>Clients and servers <bcp14>MAY</bcp14> close the connection for a variety of other
reasons, indicated using QUIC's CONNECTION_CLOSE. Client and servers
that send packets over a connection discarded by their peer might
receive a stateless reset indication. If a connection fails, all the
in-progress transactions on that connection <bcp14>MUST</bcp14> be abandoned.</t>
      </section>
      <section anchor="session-resumption-and-0-rtt" numbered="true" toc="default">
        <name>Session Resumption and 0-RTT</name>
        <t>A client <bcp14>MAY</bcp14> take advantage of the session resumption and 0-RTT mechanisms supported by
QUIC transport <xref target="RFC9000" format="default"/> and QUIC TLS <xref target="RFC9001" format="default"/> if the server supports them.
Clients <bcp14>SHOULD</bcp14> consider
potential privacy issues associated with session resumption before deciding to use
this mechanism and specifically evaluate the trade-offs presented in the various sections of this document. 
The privacy issues are detailed in Sections <xref target="privacy-issues-with-0-rtt-data" format="counter"/>
and <xref target="privacy-issues-with-session-resumption" format="counter"/>,
and the implementation considerations are discussed in
<xref target="using-0-rtt-and-session-resumption" format="default"/>.</t>
        <t>The 0-RTT mechanism <bcp14>MUST NOT</bcp14> be used to send DNS requests that are not
"replayable" transactions. In this specification, only transactions that have
an OPCODE of QUERY or NOTIFY are considered replayable; therefore, other OPCODES <bcp14>MUST NOT</bcp14>
be sent in 0-RTT data. See <xref target="the-notify-service" format="default"/> for a detailed discussion of why NOTIFY is
included here.</t>
        <t>Servers <bcp14>MAY</bcp14> support session resumption, and <bcp14>MAY</bcp14> do that with or without supporting
0-RTT, using the mechanisms described in <xref section="4.6.1" sectionFormat="of" target="RFC9001" format="default"/>.
Servers supporting 0-RTT <bcp14>MUST NOT</bcp14> immediately process
non-replayable transactions received in 0-RTT data but instead
<bcp14>MUST</bcp14> adopt one of the following behaviors:</t>
        <ul spacing="normal">
          <li>Queue the offending transaction and only process it after the QUIC handshake
has been completed, as defined in <xref section="4.1.1" sectionFormat="of" target="RFC9001" format="default"/>.</li>
          <li>Reply to the offending transaction with a response code REFUSED and
an Extended DNS Error Code (EDE) "Too Early" using the extended RCODE
mechanisms defined in <xref target="RFC6891" format="default"/> and the extended DNS errors defined in <xref target="RFC8914" format="default"/>; see
<xref target="reservation-of-extended-dns-error-code-too-early" format="default"/>.</li>
          <li>Close the connection with the error code DOQ_PROTOCOL_ERROR.</li>
        </ul>
      </section>
      <section anchor="message-sizes" numbered="true" toc="default">
        <name>Message Sizes</name>
        <t>DoQ queries and responses are sent on QUIC streams, which in theory can carry
up to 2<sup>62</sup> bytes. However, DNS messages are restricted in practice to a maximum
size of 65535 bytes. This maximum size is enforced by the use of a 2-octet
message length field in DNS over TCP <xref target="RFC1035" format="default"/> and DoT
<xref target="RFC7858" format="default"/>, and by the definition of the "application/dns-message" for DoH <xref target="RFC8484" format="default"/>. DoQ enforces the same restriction.</t>
        <t>The Extension Mechanisms for DNS (EDNS(0)) <xref target="RFC6891" format="default"/> allow peers to specify the
UDP message size. This parameter is ignored by DoQ. DoQ implementations always
assume that the maximum message size is 65535 bytes.</t>
      </section>
    </section>



    <section anchor="implementation-requirements" numbered="true" toc="default">
      <name>Implementation Requirements</name>



      <section anchor="authentication" numbered="true" toc="default">
        <name>Authentication</name>
        <t>For the stub to recursive scenario, the authentication requirements
are the same as described in DoT <xref target="RFC7858" format="default"/> and "Usage Profiles for DNS over
TLS and DNS over DTLS" <xref target="RFC8310" format="default"/>. <xref target="RFC8932" format="default"/> states that DNS privacy
services <bcp14>SHOULD</bcp14> provide credentials that clients can use to authenticate the
server. Given this, and to align with the authentication model for DoH, DoQ stubs
<bcp14>SHOULD</bcp14> use a Strict usage profile. Client authentication for the encrypted
stub to recursive scenario is not described in any DNS RFC.</t>
        <t>For zone transfer, the authentication requirements are the same as described in
<xref target="RFC9103" format="default"/>.</t>
        <t>For the recursive to authoritative scenario, authentication
requirements are unspecified at the time of writing and are the subject of
ongoing work in the DPRIVE WG.</t>
      </section>
      <section anchor="fallback-to-other-protocols-on-connection-failure" numbered="true" toc="default">
        <name>Fallback to Other Protocols on Connection Failure</name>
        <t>If the establishment of the DoQ connection fails, clients <bcp14>MAY</bcp14> attempt to
fall back to DoT and then potentially cleartext, as specified in DoT
<xref target="RFC7858" format="default"/> and "Usage Profiles for DNS over TLS and DNS over DTLS"
<xref target="RFC8310" format="default"/>, depending on their usage profile.</t>
        <t>DNS clients <bcp14>SHOULD</bcp14> remember server IP addresses that don't support DoQ.
Mobile clients might also remember the lack of DoQ support by
given IP addresses on a per-context basis (e.g., per network or provisioning domain).</t>
        <t>Timeouts, connection refusals, and QUIC handshake failures are indicators
that a server does not support DoQ.  Clients <bcp14>SHOULD NOT</bcp14> attempt DoQ queries to a
server that does not support DoQ for a reasonable period (such as one hour per
server).  DNS clients following an out-of-band key-pinned usage profile
<xref target="RFC7858" format="default"/> <bcp14>MAY</bcp14> be more aggressive about retrying after DoQ connection failures.</t>
      </section>
      <section anchor="address-validation" numbered="true" toc="default">
        <name>Address Validation</name>
        <t><xref section="8" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport specification, defines Address
Validation procedures to avoid servers being used in address amplification
attacks. DoQ implementations <bcp14>MUST</bcp14> conform to this specification, which limits
the worst-case amplification to a factor 3.</t>
        <t>DoQ implementations <bcp14>SHOULD</bcp14> consider configuring servers to use the Address
Validation using Retry Packets procedure defined in <xref section="8.1.2" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC
transport specification. This procedure imposes a 1-RTT delay for
verifying the return routability of the source address of a client, similar to
the DNS Cookies mechanism <xref target="RFC7873" format="default"/>.</t>
        <t>DoQ implementations that configure Address Validation using Retry Packets
<bcp14>SHOULD</bcp14> implement the Address Validation for Future Connections procedure
defined in <xref section="8.1.3" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport specification.
This defines how servers can send NEW_TOKEN frames to clients after the client
address is validated in order to avoid the 1-RTT penalty during subsequent
connections by the client from the same address.</t>
      </section>
      <section anchor="padding" numbered="true" toc="default">
        <name>Padding</name>
        <t>Implementations <bcp14>MUST</bcp14> protect against the traffic analysis attacks described in
<xref target="traffic-analysis" format="default"/> by the judicious injection of padding. This
could be done either by padding individual DNS messages using the
EDNS(0) Padding Option <xref target="RFC7830" format="default"/> or by padding QUIC packets (see
<xref section="19.1" sectionFormat="of" target="RFC9000" format="default"/>).</t>
        <t>In theory, padding at the QUIC packet level could result in better performance for the equivalent
protection, because the amount of padding can take into account non-DNS frames
such as acknowledgements or flow control updates, and also because QUIC packets
can carry multiple DNS messages. However, applications can only control the
amount of padding in QUIC packets if the implementation of QUIC exposes adequate APIs. This leads
to the following recommendations:</t>
        <ul spacing="normal">
          <li>If the implementation of QUIC exposes APIs to set a padding policy,
DoQ <bcp14>SHOULD</bcp14> use that API to align the packet length to a small set of
fixed sizes.</li>
          <li>If padding at the QUIC packet level is not available or not used,
DoQ <bcp14>MUST</bcp14> ensure that all DNS queries and responses are padded to
a small set of fixed sizes, using the EDNS(0) padding extension as specified
in <xref target="RFC7830" format="default"/>.</li>
        </ul>
        <t>Implementations might choose not to use a QUIC API for padding if it is
significantly simpler to reuse existing DNS message padding logic that is
applied to other encrypted transports.</t>
        <t>In the absence of a standard policy for padding sizes, implementations <bcp14>SHOULD</bcp14>
follow the recommendations of the Experimental status "Padding Policies for
Extension Mechanisms for DNS (EDNS(0))" <xref target="RFC8467" format="default"/>. While Experimental,
these recommendations are referenced because they are implemented and deployed
for DoT and provide a way for implementations to be fully compliant with this
specification.</t>
      </section>
      <section anchor="connection-handling" numbered="true" toc="default">
        <name>Connection Handling</name>
        <t>"DNS Transport over TCP - Implementation Requirements" <xref target="RFC7766" format="default"/> provides
updated guidance on DNS over TCP, some of which is applicable to DoQ. This 
section provides similar advice on connection handling for DoQ.</t>
        <section anchor="connection-reuse" numbered="true" toc="default">
          <name>Connection Reuse</name>
          <t>Historic implementations of DNS clients are known to open and close TCP
connections for each DNS query. To amortize connection setup costs, both
clients and servers <bcp14>SHOULD</bcp14> support connection reuse by sending multiple queries
and responses over a single persistent QUIC connection.</t>
          <t>In order to achieve performance on par with UDP, DNS clients <bcp14>SHOULD</bcp14> send their
queries concurrently over the QUIC streams on a QUIC connection. That is, when
a DNS client sends multiple queries to a server over a QUIC connection, it
<bcp14>SHOULD NOT</bcp14> wait for an outstanding reply before sending the next query.</t>
        </section>
        <section anchor="resource-management" numbered="true" toc="default">
          <name>Resource Management</name>
          <t>Proper management of established and idle connections is important to the
healthy operation of a DNS server.</t>
          <t>An implementation of DoQ <bcp14>SHOULD</bcp14> follow best practices similar to those
specified for DNS over TCP <xref target="RFC7766" format="default"/>, in particular with regard to:</t>
          <ul spacing="normal">
            <li>Concurrent Connections (<xref section="6.2.2" sectionFormat="of" target="RFC7766" format="default"/>, updated by <xref section="6.4" sectionFormat="of" target="RFC9103" format="default"/>)</li>
            <li>Security Considerations (<xref section="10" sectionFormat="of" target="RFC7766" format="default"/>)</li>
          </ul>
          <t>Failure to do so may lead to resource exhaustion and denial of service.</t>
          <t>Clients that want to maintain long duration DoQ connections <bcp14>SHOULD</bcp14> use the idle
timeout mechanisms defined in <xref section="10.1" sectionFormat="of" target="RFC9000" format="default"/>, the QUIC transport
specification. Clients and servers <bcp14>MUST NOT</bcp14> send the edns-tcp-keepalive EDNS(0)
Option <xref target="RFC7828" format="default"/> in any messages sent on a DoQ connection (because it is
specific to the use of TCP/TLS as a transport).</t>
          <t>This document does not make specific recommendations for timeout values on idle
connections. Clients and servers should reuse and/or close connections
depending on the level of available resources. Timeouts may be longer during
periods of low activity and shorter during periods of high activity.</t>
        </section>
        <section anchor="using-0-rtt-and-session-resumption" numbered="true" toc="default">
          <name>Using 0-RTT and Session Resumption</name>
          <t>Using 0-RTT for DoQ has many compelling advantages. Clients
can establish connections and send queries without incurring a connection
delay. Servers can thus negotiate low values of the connection
timers, which reduces the total number of connections that they need to
manage. They can do that because the clients that use 0-RTT will not incur
latency penalties if new connections are required for a query.</t>
          <t>Session resumption and 0-RTT data transmission create
privacy risks detailed in Sections  <xref target="privacy-issues-with-0-rtt-data" format="counter"/> and <xref target="privacy-issues-with-session-resumption" format="counter" />.
The following recommendations are meant to reduce the privacy
risks while enjoying the performance benefits of 0-RTT data, subject to the
restrictions specified in <xref target="session-resumption-and-0-rtt" format="default"/>.</t>
<t>Clients <bcp14>SHOULD</bcp14> use resumption tickets only once, as
specified in <xref target="RFC8446" sectionFormat="of" section="C.4" />. By
default, clients <bcp14>SHOULD NOT</bcp14> use session resumption if the
client's connectivity has changed.</t>
          <t>Clients could receive address validation tokens from the server using the
NEW_TOKEN mechanism; see <xref section="8" sectionFormat="of" target="RFC9000" format="default"/>. The associated tracking
risks are mentioned in <xref target="privacy-issues-with-address-validation-tokens" format="default"/>.
Clients <bcp14>SHOULD</bcp14> only use the address validation tokens when they are also using session
resumption thus avoiding additional tracking risks.</t>
          <t>Servers <bcp14>SHOULD</bcp14> issue session resumption tickets with a sufficiently long lifetime (e.g., 6 hours),
so that clients are not tempted to either keep the connection alive or frequently poll the server
to renew session resumption tickets.
Servers <bcp14>SHOULD</bcp14> implement the anti-replay mechanisms specified in <xref section="8" sectionFormat="of" target="RFC8446" format="default"/>.</t>
        </section>
        <section anchor="controlling-connection-migration-for-privacy" numbered="true" toc="default">
          <name>Controlling Connection Migration for Privacy</name>
          <t>DoQ implementations might consider using the connection migration features defined
in <xref section="9" sectionFormat="of" target="RFC9000" format="default"/>. These features enable connections to continue operating
as the client's connectivity changes.
As detailed in <xref target="privacy-issues-with-long-duration-sessions" format="default"/>, these features
trade off privacy for latency. By default, clients <bcp14>SHOULD</bcp14> be configured
to prioritize privacy and start new sessions if their connectivity changes.</t>
        </section>
      </section>
      <section anchor="processing-queries-in-parallel" numbered="true" toc="default">
        <name>Processing Queries in Parallel</name>
        <t>As specified in <xref section="7" sectionFormat="of" target="RFC7766" format="default"/> "DNS Transport over TCP - Implementation
Requirements", resolvers are <bcp14>RECOMMENDED</bcp14> to support the preparing
of responses in parallel and sending them out of order. In DoQ, they do that by
sending responses on their specific stream as soon as possible, without waiting
for availability of responses for previously opened streams.</t>
      </section>
      <section anchor="zone-transfer" numbered="true" toc="default">
        <name>Zone Transfer</name>
        <t><xref target="RFC9103" format="default"/> specifies zone transfer over TLS (XoT)
and includes updates to <xref target="RFC1995" format="default"/> (IXFR), <xref target="RFC5936" format="default"/> (AXFR), and
<xref target="RFC7766" format="default"/>. Considerations relating to the reuse of XoT connections
described there apply analogously to zone transfers performed using DoQ
connections. One reason for reiterating such specific guidance is the
lack of effective connection reuse in existing TCP/TLS zone transfer
implementations today. The following recommendations apply:</t>
        <ul spacing="normal">
          <li>DoQ servers <bcp14>MUST</bcp14> be able to handle multiple concurrent IXFR requests on a
single QUIC connection.</li>
          <li>DoQ servers <bcp14>MUST</bcp14> be able to handle multiple concurrent AXFR requests on a
single QUIC connection.</li>
          <li>
            <t>DoQ implementations <bcp14>SHOULD</bcp14>
            </t>
            <ul spacing="normal">
              <li>use the same QUIC connection for both AXFR and IXFR requests to the same
primary</li>
              <li>send those requests in parallel as soon as they are queued, i.e., do not wait
for a response before sending the next query on the connection
(this is analogous to pipelining requests on a TCP/TLS connection)</li>
              <li>send the response(s) for each request as soon as they are available, i.e.,
response streams <bcp14>MAY</bcp14> be sent intermingled</li>
            </ul>
          </li>
        </ul>
      </section>
      <section anchor="flow-control-mechanisms" numbered="true" toc="default">
        <name>Flow Control Mechanisms</name>
        <t>Servers and clients manage flow control using the mechanisms defined in
<xref section="4" sectionFormat="of" target="RFC9000" format="default"/>. These mechanisms allow clients and servers to specify
how many streams can be created, how much data can be sent on a stream,
and how much data can be sent on the union of all streams. For DoQ,
controlling how many streams are created allows servers to control how many
new requests the client can send on a given connection.</t>
        <t>Flow control exists to protect endpoint resources.
For servers, global and per-stream flow control limits control how much data can be sent by
clients. The same mechanisms
allow clients to control how much data can be sent by servers.
Values that are too small will unnecessarily limit performance.
Values that are too large might expose endpoints to overload or memory exhaustion.
Implementations or deployments will need to adjust flow control limits to
balance these concerns. In particular, zone transfer implementations will need to control
these limits carefully to ensure both large and concurrent zone transfers are well managed.</t>
        <t>Initial values of parameters control how many requests and how much data can be
sent by clients and servers at the beginning of the connection. These values
are specified in transport parameters exchanged during the connection handshake.
The parameter values received in the initial connection also control how many requests and
how much data can be sent by clients using 0-RTT data in a resumed connection.
Using too small values of these initial parameters would restrict the
usefulness of allowing 0-RTT data.</t>
      </section>
    </section>

    <section anchor="security-considerations" numbered="true" toc="default">
      <name>Security Considerations</name>

      <t>A Threat Analysis of the Domain Name System is found in <xref target="RFC3833" format="default"/>.
This analysis was written before the development of DoT, DoH, and DoQ, and
probably needs to be updated.</t>
      <t>The security considerations of DoQ should be comparable to those of DoT
<xref target="RFC7858" format="default"/>. DoT as specified in <xref target="RFC7858" format="default"/> only addresses the stub to recursive scenario, but the considerations about person-in-the-middle
attacks, middleboxes, and caching of data from cleartext connections also
apply for DoQ to the resolver to authoritative server scenario. 
As stated in <xref target="authentication" format="default"/>, the authentication requirements for securing zone transfer using DoQ are the same as those for zone transfer over DoT; therefore, the general security considerations are entirely analogous to those described in <xref target="RFC9103" format="default"/>.</t>
      <t>DoQ relies on QUIC, which itself relies on TLS 1.3 and thus supports by default
the protections against downgrade attacks described in <xref target="BCP195" format="default"/>.
QUIC-specific issues and their mitigations are described in
<xref section="21" sectionFormat="of" target="RFC9000" format="default"/>.</t>
    </section>
    <section anchor="privacy-considerations" numbered="true" toc="default">
      <name>Privacy Considerations</name>
      <t>The general considerations of encrypted transports provided in "DNS Privacy
Considerations" <xref target="RFC9076" format="default"/> apply to DoQ. The specific
considerations provided there do not differ between DoT and DoQ, and they are not
discussed further here. Similarly, "Recommendations for DNS Privacy Service
Operators" <xref target="RFC8932" format="default"/> (which covers operational, policy, and security
considerations for DNS privacy services) is also applicable to DoQ services.</t>
      <t>QUIC incorporates the mechanisms of TLS 1.3 <xref target="RFC8446" format="default"/>, and this enables QUIC
transmission of "0-RTT" data. This can provide interesting latency gains, but
it raises two concerns:</t>
      <ol spacing="normal" type="1"><li>Adversaries could replay the 0-RTT data and infer its content
from the behavior of the receiving server.</li>
        <li>The 0-RTT mechanism relies on TLS session resumption, which can provide
linkability between successive client sessions.</li>
      </ol>
      <t>These issues are developed in Sections <xref
      target="privacy-issues-with-0-rtt-data"
      format="counter"/> and <xref
      target="privacy-issues-with-session-resumption"
      format="counter"/>.</t>
      <section anchor="privacy-issues-with-0-rtt-data" numbered="true" toc="default">
        <name>Privacy Issues with 0-RTT data</name>
        <t>The 0-RTT data can be replayed by adversaries. That data may trigger queries by
a recursive resolver to authoritative resolvers. Adversaries may be able to
pick a time at which the recursive resolver outgoing traffic is observable and
thus find out what name was queried for in the 0-RTT data.</t>
        <t>This risk is in fact a subset of the general problem of observing the behavior
of the recursive resolver discussed in "DNS Privacy Considerations"
<xref target="RFC9076" format="default"/>. The attack is partially mitigated by reducing the observability
of this traffic. The mandatory replay protection mechanisms in
TLS 1.3 <xref target="RFC8446" format="default"/> limit but do not eliminate the risk of replay.
0-RTT packets can only be replayed within a narrow window,
which is only wide enough to account for variations in clock skew and network transmission.</t>
        <t>The recommendation for TLS 1.3 <xref target="RFC8446" format="default"/> is that the capability to use 0-RTT
data should be turned off by default and only enabled if the user clearly
understands the associated risks. In the case of DoQ, allowing 0-RTT data
provides significant performance gains, and there is a concern that a
recommendation to not use it would simply be ignored. Instead, a set of
practical recommendations is provided in Sections <xref target="session-resumption-and-0-rtt" format="counter"/> and
<xref target="using-0-rtt-and-session-resumption" format="counter"/>.</t>
        <t>The specifications in <xref target="session-resumption-and-0-rtt" format="default"/> block the most obvious
risks of replay attacks, as they only allow for transactions that will
not change the long-term state of the server.</t>
        <t>The attacks described above apply to the stub resolver to recursive resolver scenario, but similar attacks might be envisaged in the
recursive resolver to authoritative resolver scenario, and the
same mitigations apply.</t>
      </section>
      <section anchor="privacy-issues-with-session-resumption" numbered="true" toc="default">
        <name>Privacy Issues with Session Resumption</name>
        <t>The QUIC session resumption mechanism reduces the cost of re-establishing sessions
and enables 0-RTT data. There is a linkability issue associated with session
resumption, if the same resumption token is used several times. Attackers on path
between client and server could observe repeated usage of the token and
use that to track the client over time or over multiple locations.</t>
        <t>The session resumption mechanism allows servers to correlate the resumed sessions
with the initial sessions and thus to track the client. This creates a virtual
long duration session. The series of queries in that session can be used by the
server to identify the client. Servers can most probably do that already if
the client address remains constant, but session resumption tickets also enable
tracking after changes of the client's address.</t>
        <t>The recommendations in <xref target="using-0-rtt-and-session-resumption" format="default"/> are designed to
mitigate these risks. Using session tickets only once mitigates
the risk of tracking by third parties. Refusing to resume a session if addresses
change mitigates the incremental risk of tracking by the server (but the risk of
tracking by IP address remains).</t>
        <t>The privacy trade-offs here may be context specific. Stub resolvers will have a strong
motivation to prefer privacy over latency since they often change location. However,
recursive resolvers that use a small set of static IP addresses are more likely to prefer the reduced
latency provided by session resumption and may consider this a valid reason to use
resumption tickets even if the IP address changed between sessions.</t>
        <t>Encrypted zone transfer (<xref target="RFC9103"/>) explicitly does
not attempt to hide the identity of the parties involved in the transfer; at the
same time, such transfers are not particularly latency sensitive. This means that
applications supporting zone transfers may decide to apply the same
protections as stub to recursive applications.</t>
      </section>

      <section anchor="privacy-issues-with-address-validation-tokens" numbered="true" toc="default">
        <name>Privacy Issues with Address Validation Tokens</name>
        <t>QUIC specifies address validation mechanisms in <xref section="8" sectionFormat="of" target="RFC9000" format="default"/>. Use
of an address validation token allows QUIC servers to avoid an extra RTT for
new connections. Address validation tokens are typically tied to an IP address.
QUIC clients normally only use these tokens when setting up a new connection
from a previously used address. However, clients are not always aware that they
are using a new address. This could be due to NAT, or because the client does
not have an API available to check if the IP address has changed (which can be
quite often for IPv6). There is a linkability risk if clients mistakenly use
address validation tokens after unknowingly moving to a new location.</t>
        <t>The recommendations in <xref target="using-0-rtt-and-session-resumption" format="default"/> mitigates
this risk by tying the usage of the NEW_TOKEN to that of session resumption,
though this recommendation does not cover the case where the client is unaware
of the address change.</t>
      </section>
      <section anchor="privacy-issues-with-long-duration-sessions" numbered="true" toc="default">
        <name>Privacy Issues with Long Duration Sessions</name>
        <t>A potential alternative to session resumption is the use of long duration sessions:
if a session remains open for a long time, new queries can be sent without incurring
connection establishment delays. It is worth pointing out that the two solutions have
similar privacy characteristics. Session resumption may allow servers to keep track
of the IP addresses of clients, but long duration sessions have the same effect.</t>
        <t>In particular, a DoQ implementation might take advantage of the connection migration
features of QUIC to maintain a session even if the client's connectivity changes,
for example, if the client migrates from a Wi-Fi connection to a cellular network
connection and then to another Wi-Fi connection. The server would be
able to track the client location by monitoring the succession of IP addresses
used by the long duration connection.</t>
        <t>The recommendation in <xref target="controlling-connection-migration-for-privacy" format="default"/> mitigates
the privacy concerns related to long duration sessions using multiple client addresses.</t>
      </section>
      <section anchor="traffic-analysis" numbered="true" toc="default">
        <name>Traffic Analysis</name>
        <t>Even though QUIC packets are encrypted, adversaries can gain information from
observing packet lengths, in both queries and responses, as well as packet
timing. Many DNS requests are emitted by web browsers. Loading a specific web
page may require resolving dozens of DNS names. If an application adopts a
simple mapping of one query or response per packet, or "one QUIC STREAM frame
per packet", then the succession of packet lengths may provide enough
information to identify the requested site.</t>
        <t>Implementations <bcp14>SHOULD</bcp14> use the mechanisms defined in <xref target="padding" format="default"/> to mitigate
this attack.</t>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section anchor="registration-of-doq-identification-string" numbered="true" toc="default">
        <name>Registration of a DoQ Identification String</name>
        <t>This document creates a new registration for the identification of DoQ in the
"TLS Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry
<xref target="RFC7301" format="default"/>.</t>
        <t>The "doq" string identifies DoQ:</t>
        <dl>
          <dt>
Protocol:  </dt>
          <dd>
            <t>DoQ</t>
          </dd>
          <dt>
Identification Sequence:  </dt>
          <dd>
            <t>0x64 0x6F 0x71 ("doq")</t>
          </dd>
          <dt>
Specification:  </dt>
          <dd>
            <t>This document</t>
          </dd>
        </dl>
      </section>
      <section anchor="reservation-of-dedicated-port" numbered="true" toc="default">
        <name>Reservation of a Dedicated Port</name>
        <t>For both TCP and UDP, port 853 is currently reserved for "DNS query-response 
protocol run over TLS/DTLS" <xref target="RFC7858" format="default"/>.</t>
        <t>However, the specification for DNS over DTLS (DoD)
<xref target="RFC8094" format="default"/> is experimental, limited to stub to resolver, and no
implementations or deployments currently exist to the authors' knowledge (even though
several years have passed since the specification was published).</t>
        <t>This specification additionally reserves the use of UDP port 853 for
DoQ. QUIC version 1 was designed to be able to coexist with other protocols on
the same port, including DTLS; see <xref section="17.2" sectionFormat="of" target="RFC9000" format="default"/>. This means
that deployments that serve DoD and DoQ (QUIC version 1) on the
same port will be able to demultiplex the two due to the second most
significant bit in each UDP payload. Such deployments ought to check the
signatures of future versions or extensions (e.g., <xref target="I-D.ietf-quic-bit-grease" format="default"/>)
of QUIC and DTLS before deploying them to serve DNS on the same port.</t>
        <t>IANA has updated the following value in the "Service Name and Transport
Protocol Port Number Registry" in the System range. The registry for that range
requires IETF Review or IESG Approval <xref target="RFC6335" format="default"/>.</t>
        <dl>
          <dt>
Service Name:  </dt>
          <dd>
            <t>domain-s</t>
          </dd>
          <dt>
Port Number:  </dt>
          <dd>
            <t>853</t>
          </dd>
          <dt>
Transport Protocol(s):  </dt>
          <dd>
            <t>UDP</t>
          </dd>
          <dt>
Assignee:  </dt>
          <dd>
            <t>IESG</t>
          </dd>
          <dt>
Contact:  </dt>
          <dd>
            <t>IETF Chair</t>
          </dd>
          <dt>
Description:  </dt>
          <dd>
            <t>DNS query-response protocol run over DTLS or QUIC</t>
          </dd>
          <dt>
Reference:  </dt>
          <dd>
            <t><xref target="RFC7858" format="default"/><xref target="RFC8094" format="default"/> This document</t>
          </dd>
        </dl>
        <t>Additionally, IANA has updated the Description field for the
corresponding TCP port 853 allocation to be "DNS query-response protocol run
over TLS" and removed <xref target="RFC8094"/> from the TCP allocation's Reference field for consistency and clarity.</t>

      </section>
      <section anchor="reservation-of-extended-dns-error-code-too-early" numbered="true" toc="default">
        <name>Reservation of an Extended DNS Error Code: Too Early</name>
        <t>IANA has registered the following value in
the "Extended DNS Error Codes" registry <xref target="RFC8914" format="default"/>:</t>
        <dl>
          <dt>
INFO-CODE:  </dt>
          <dd>
            <t>26</t>
          </dd>
          <dt>
Purpose:  </dt>
          <dd>
            <t>Too Early</t>
          </dd>
          <dt>
Reference:  </dt>
          <dd>
            <t>This document</t>
          </dd>
        </dl>
      </section>
      <section anchor="iana-error-codes" numbered="true" toc="default">
        <name>DNS-over-QUIC Error Codes Registry</name>

        <t>IANA has added a registry for "DNS-over-QUIC Error Codes" on the
"Domain Name System (DNS) Parameters" web page.</t>
        <t>The "DNS-over-QUIC Error Codes" registry governs a 62-bit space. This space is
split into three regions that are governed by different policies:</t>
        <ul spacing="normal">
          <li>Permanent registrations for values between 0x00 and 0x3f (in hexadecimal;
inclusive), which are assigned using Standards Action or IESG Approval as
defined in Sections <xref target="RFC8126" section="4.9"  sectionFormat="bare"/> and <xref target="RFC8126" section="4.10" sectionFormat="bare"/> of <xref target="RFC8126" format="default"/></li>
          <li>Permanent registrations for values larger than 0x3f, which are assigned
using the Specification Required policy (<xref target="RFC8126" format="default"/>)</li>
          <li>Provisional registrations for values larger than 0x3f, which require Expert
Review, as defined in <xref section="4.5" sectionFormat="of" target="RFC8126" format="default"/>.</li>
        </ul>
        <t>Provisional reservations share the range of values larger than 0x3f
with some permanent registrations. This is by design to enable conversion
of provisional registrations into permanent registrations without requiring
changes in deployed systems. (This design is aligned with the principles
set in <xref section="22" sectionFormat="of" target="RFC9000" format="default"/>.)</t>
        <t>Registrations in this registry <bcp14>MUST</bcp14> include the following fields:</t>
        <dl>
          <dt>
Value:  </dt>
          <dd>
            <t>The assigned codepoint</t>
          </dd>
          <dt>
Status:  </dt>
          <dd>
            <t>"Permanent" or "Provisional"</t>
          </dd>
          <dt>
Contact:  </dt>
          <dd>
            <t>Contact details for the registrant</t>
          </dd>
        </dl>
        <t>In addition, permanent registrations <bcp14>MUST</bcp14> include:</t>
        <dl>
          <dt>
Error:  </dt>
          <dd>
            <t>A short mnemonic for the parameter</t>
          </dd>
          <dt>
Specification:  </dt>
          <dd>
            <t>A reference to a publicly available specification for the value (optional for provisional registrations)</t>
          </dd>
          <dt>
Description:  </dt>
          <dd>
            <t>A brief description of the error code semantics, which <bcp14>MAY</bcp14> be a summary if a
specification reference is provided</t>
          </dd>
        </dl>
        <t>Provisional registrations of codepoints are intended to allow for private use
and experimentation with extensions to DoQ.  However,
provisional registrations could be reclaimed and reassigned for other purposes.
In addition to the parameters listed above, provisional registrations <bcp14>MUST</bcp14> include:</t>
        <dl>
          <dt>
Date:  </dt>
          <dd>
            <t>The date of last update to the registration</t>
          </dd>
        </dl>
        <t>A request to update the date on any provisional
registration can be made without review from the designated expert(s).</t>
        <t>The initial content of this registry is shown in <xref target="iana-error-table" format="default"/> and all
entries share the following fields:</t>
        <dl>
          <dt>
Status:  </dt>
          <dd>
            <t>Permanent</t>
          </dd>
          <dt>
Contact:  </dt>
          <dd>
            <t>DPRIVE WG</t>
          </dd>
          <dt>
Specification:  </dt>
          <dd>
            <t><xref target="doq-error-codes" format="default"/></t>
          </dd>
        </dl>
        <table anchor="iana-error-table" align="center">
          <name>Initial DNS-over-QUIC Error Codes Entries</name>
          <thead>
            <tr>
              <th align="left">Value</th>
              <th align="left">Error</th>
              <th align="left">Description</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0x0</td>
              <td align="left">DOQ_NO_ERROR</td>
              <td align="left">No error</td>
            </tr>
            <tr>
              <td align="left">0x1</td>
              <td align="left">DOQ_INTERNAL_ERROR</td>
              <td align="left">Implementation error</td>
            </tr>
            <tr>
              <td align="left">0x2</td>
              <td align="left">DOQ_PROTOCOL_ERROR</td>
              <td align="left">Generic protocol violation</td>
            </tr>
            <tr>
              <td align="left">0x3</td>
              <td align="left">DOQ_REQUEST_CANCELLED</td>
              <td align="left">Request cancelled by client</td>
            </tr>
            <tr>
              <td align="left">0x4</td>
              <td align="left">DOQ_EXCESSIVE_LOAD</td>
              <td align="left">Closing a connection for excessive load</td>
            </tr>
            <tr>
              <td align="left">0x5</td>
              <td align="left">DOQ_UNSPECIFIED_ERROR</td>
              <td align="left">No error reason specified</td>
            </tr>
            <tr>
              <td align="left">0xd098ea5e</td>
              <td align="left">DOQ_ERROR_RESERVED</td>
              <td align="left">Alternative error code used for tests</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>

  </middle>
  <back>
    <displayreference target="I-D.ietf-dnsop-rfc8499bis" to="DNS-TERMS"/>
    <displayreference target="I-D.ietf-quic-bit-grease" to="GREASING-QUIC"/>
    <displayreference target="I-D.ietf-quic-http" to="HTTP/3"/>
    


    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1034.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1035.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9000.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9001.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7858.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8310.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1995.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6891.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8914.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9103.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7830.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8467.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7766.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5936.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7301.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="DNS0RTT" target="https://www.ietf.org/mail-archive/web/dns-privacy/current/msg01276.html">
          <front>
            <title>DNS + 0-RTT</title>
            <author initials="D." surname="Kahn Gillmor" fullname="Daniel Kahn Gillmor">
              <organization/>
            </author>
            <date year="2016" month="April" day="06"/>
          </front>
          <seriesInfo name="Message" value="to DNS-Privacy WG mailing list"/>
        </reference>

	<xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-ietf-dnsop-rfc8499bis.xml"/>

	
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8490.xml"/>

<reference anchor="I-D.ietf-quic-http" target="https://datatracker.ietf.org/doc/html/draft-ietf-quic-http-34">
<front>
<title>Hypertext Transfer Protocol Version 3 (HTTP/3)</title>
<author initials='M' surname='Bishop' fullname='Mike Bishop' role='editor'>
  <organization/>
</author>
<date day='2' month='February' year='2021'/>
</front>
<seriesInfo name="Internet-Draft" value="draft-ietf-quic-http-34"/>

</reference>

        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8484.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9076.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9002.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7828.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8932.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7873.xml"/>

        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3833.xml"/>
        <referencegroup anchor="BCP195" target="https://www.rfc-editor.org/info/bcp195">

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7525.xml"/>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8996.xml"/>
        </referencegroup>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8094.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-ietf-quic-bit-grease.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6335.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1996.xml"/>
      </references>
    </references>

    <section anchor="the-notify-service" numbered="true" toc="default">
      <name>The NOTIFY Service</name>
      <t>This appendix discusses why it is considered acceptable to send NOTIFY
(see <xref target="RFC1996" format="default"/>) in 0-RTT data.</t>
      <t><xref target="session-resumption-and-0-rtt" format="default"/> says "The 0-RTT mechanism <bcp14>MUST NOT</bcp14>
be used to send DNS requests that are not "replayable" transactions". This
specification supports sending a NOTIFY in 0-RTT data because
although a NOTIFY technically changes the state of the receiving server, the
effect of replaying NOTIFYs has negligible impact in practice.</t>
      <t>NOTIFY messages prompt a secondary to either send an SOA query or an XFR
request to the primary on the basis that a newer version of the zone is
available. It has long been recognized that NOTIFYs can be forged and, in
theory, used to cause a secondary to send repeated unnecessary requests to the
primary. For this reason, most implementations have some form of throttling of the
SOA/XFR queries triggered by the receipt of one or more NOTIFYs.</t>
      <t><xref target="RFC9103" format="default"/> describes the privacy risks associated with both NOTIFY and SOA queries
and does not include addressing those risks within the scope of encrypting zone
transfers. Given this, the privacy benefit of using DoQ for NOTIFY is not clear,
but for the same reason, sending NOTIFY as 0-RTT data has no privacy risk above
that of sending it using cleartext DNS.</t>
    </section>


    <section anchor="acknowledgements" numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>This document liberally borrows text from the HTTP/3 specification
      <xref target="I-D.ietf-quic-http" format="default"/> edited by <contact fullname="Mike
      Bishop"/> and from the DoT specification <xref target="RFC7858"
      format="default"/> authored by <contact fullname="Zi Hu"/>, <contact fullname="Liang Zhu"/>, <contact fullname="John Heidemann"/>, <contact fullname="Allison
      Mankin"/>, <contact fullname="Duane Wessels"/>, and <contact fullname="Paul Hoffman"/>.</t>
      <t>The privacy issue with 0-RTT data and session resumption was
      analyzed by <contact fullname="Daniel Kahn Gillmor"/> (DKG) in a message to the IETF DPRIVE
      Working Group <xref target="DNS0RTT" format="default"/>.</t>
      <t>Thanks to <contact fullname="Tony Finch"/> for an extensive review of the initial draft version
      of this document, and to <contact fullname="Robert Evans"/> for the discussion of 0-RTT privacy
      issues.  Early reviews by <contact fullname="Paul Hoffman"/> and <contact fullname="Martin Thomson"/> and
      interoperability tests conducted by Stephane Bortzmeyer helped improve
      the definition of the protocol.</t>
      <t>Thanks also to <contact fullname="Martin Thomson"/> and <contact fullname="Martin Duke"/> for their later reviews
      focusing on the low-level QUIC details, which helped clarify several
      aspects of DoQ. Thanks to <contact fullname="Andrey Meshkov"/>, <contact fullname="Loganaden Velvindron"/>, <contact fullname="Lucas
      Pardue"/>, <contact fullname="Matt Joras"/>, <contact fullname="Mirja Kuelewind"/>, <contact fullname="Brian Trammell"/>, and <contact fullname="Phillip
      Hallam-Baker"/> for their reviews and contributions.</t>
    </section>

  </back>

</rfc>
