<?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.5 (Ruby 3.2.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-quic-address-discovery-01" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.19.4 -->
  <front>
    <title abbrev="QUIC Address Discovery">QUIC Address Discovery</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-quic-address-discovery-01"/>
    <author fullname="Marten Seemann">
      <organization/>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="February" day="29"/>
    <area>Transport</area>
    <workgroup>QUIC</workgroup>
    <keyword>QUIC</keyword>
    <keyword>STUN</keyword>
    <keyword>Address Discovery</keyword>
    <abstract>
      <?line 39?>

<t>Unless they have out-of-band knowledge, QUIC endpoints have no information about
their network situation. They neither know their external IP address and port,
nor do they know if they are directly connected to the internet or if they are
behind a NAT. This QUIC extension allows nodes to determine their public IP
address and port for any QUIC path.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://marten-seemann.github.io/draft-seemann-quic-address-discovery/draft-seemann-quic-address-discovery.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-seemann-quic-address-discovery/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        QUIC Working Group mailing list (<eref target="mailto:quic@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/quic/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/quic/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/marten-seemann/draft-seemann-quic-address-discovery"/>.</t>
    </note>
  </front>
  <middle>
    <?line 48?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>STUN (<xref target="RFC8489"/>) allows nodes to discover their reflexive transport address
by asking a remote server to report the observed source address. While the QUIC
(<xref target="RFC9000"/>) packet header was designed to allow demultiplexing from STUN
packets, moving address discovery into the QUIC layer has a number of
advantages:</t>
      <ol spacing="normal" type="1"><li>
          <t>STUN traffic is unencrypted, and can be observed and modified by on-path
observers. By moving address discovery into QUIC's encrypted envelope it
becomes invisible to observers.</t>
        </li>
        <li>
          <t>When located behind a load balancer, QUIC packets may be routed based on the
QUIC connection ID. Depending on the architecture, not using STUN might
simplify the routing logic.</t>
        </li>
        <li>
          <t>If QUIC traffic doesn't need to be demultiplexed from STUN traffic,
implementations can enable QUIC bit greasing (<xref target="RFC9287"/>).</t>
        </li>
      </ol>
    </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?>

</section>
    <section anchor="negotiate-extension">
      <name>Negotiating Extension Use</name>
      <t>Endpoints advertise their support of the extension by sending the
address_discovery (0x9f81a174) transport parameter (<xref section="7.4" sectionFormat="of" target="RFC9000"/>)
with a variable-length integer value. The value determines the behavior with
respect to address discovery:</t>
      <ul spacing="normal">
        <li>
          <t>0: The node is willing to provide address observations to its peer, but is not
interested in receiving address observations itself.</t>
        </li>
        <li>
          <t>1: The node is interested in receiving address observations, but it is not
willing to provide address observations.</t>
        </li>
        <li>
          <t>2: The node is interested in receiving address observations, and it is willing
to provide address observations.</t>
        </li>
      </ul>
      <t>Implementations that understand this transport parameter <bcp14>MUST</bcp14> treat the receipt
of any other value than these as a connection error of type
TRANSPORT_PARAMETER_ERROR.</t>
      <t>When using 0-RTT, both endpoints <bcp14>MUST</bcp14> remember the value of this transport
parameter. This allows sending the frame defined by this extension in 0-RTT
packets. If 0-RTT data is accepted by the server, the server <bcp14>MUST NOT</bcp14> disable
this extension or change the value on the resumed connection.</t>
    </section>
    <section anchor="frames">
      <name>Frames</name>
      <t>This extension defines the OBSERVED_ADDRESS frame.</t>
      <section anchor="observedaddress">
        <name>OBSERVED_ADDRESS</name>
        <artwork><![CDATA[
OBSERVED_ADDRESS Frame {
    Type (i) = 0x9f81a2..0x9f81a3,
    Request ID (i),
    [ IPv4 (32) ],
    [ IPv6 (128) ],
    Port (16),
}
]]></artwork>
        <t>The OBSERVED_ADDRESS frame contains the following fields:</t>
        <dl>
          <dt>Request ID:</dt>
          <dd>
            <t>The request identifier of the request for which this response is intended.</t>
          </dd>
          <dt>IPv4:</dt>
          <dd>
            <t>The IPv4 address. Only present if the least significant bit of the frame type
is 0.</t>
          </dd>
          <dt>IPv6:</dt>
          <dd>
            <t>The IPv6 address. Only present if the least significant bit of the frame type
is 1.</t>
          </dd>
          <dt>Port:</dt>
          <dd>
            <t>The port number, in network byte order.</t>
          </dd>
        </dl>
        <t>This frame <bcp14>MUST</bcp14> only appear in the handshake and in the application data packet
number space. It is a "probing frame" as defined in <xref section="9.1" sectionFormat="of" target="RFC9000"/>.
OBSERVED_ADDRESS frames are ack-eliciting, and <bcp14>SHOULD</bcp14> be retransmitted if lost.</t>
        <t>An endpoint <bcp14>MUST NOT</bcp14> send an OBSERVED_ADDRESS frame to a node that did not
request the receipt of address observations as described in
<xref target="negotiate-extension"/>. A node that did not request the receipt of address
observations <bcp14>MUST</bcp14> close the connection with a PROTOCOL_VIOLATION error if it
receives an OBSERVED_ADDRESS frame.</t>
      </section>
    </section>
    <section anchor="address-discovery">
      <name>Address Discovery</name>
      <t>An endpoint that negotiated (see <xref target="negotiate-extension"/>) this extension and
offered to provide address observations to the peer <bcp14>MUST</bcp14> send an
OBSERVED_ADDRESS frame on every new path. This also applies to the path used for
the QUIC handshake.</t>
      <t>The OBSERVED_ADDRESS frame <bcp14>SHOULD</bcp14> be sent as early as possible. However, during
the handshake an endpoint <bcp14>SHOULD</bcp14> prioritize frames that lead to handshake
progress (CRYPTO and ACK frames in particular) over sending of the
OBSERVED_ADDRESS frame.</t>
      <t>For paths used after completion of the handshake, endpoints <bcp14>SHOULD</bcp14> bundle the
OBSERVED_ADDRESS frame with probing packets. This is possible, since the frame
is defined to be a probing frame (<xref section="8.2" sectionFormat="of" target="RFC9000"/>).</t>
      <t>Additionally, the sender <bcp14>SHOULD</bcp14> send an OBSERVED_ADDRESS frame when it detects a
change in the remote address on an existing path. This could be indicative of a
NAT rebindings.</t>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <section anchor="on-the-requester-side">
        <name>On the Requester Side</name>
        <t>In general, nodes cannot be trusted to report the correct address in
OBSERVED_ADDRESS frames. If possible, endpoints might decide to only request
address observations when connecting to trusted peers, or if that is not
possible, define some validation logic (e.g. by asking multiple untrusted peers
and observing if the responses are consistent). This logic is out of scope for
this document.</t>
      </section>
      <section anchor="on-the-responder-side">
        <name>On the Responder Side</name>
        <t>Depending on the routing setup, a node might not be able to observe the peer's
reflexive transport address, and attempts to do so might reveal details about
the internal network. In these cases, the node <bcp14>SHOULD NOT</bcp14> offer to provide
address observations.</t>
      </section>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>TODO: fill out registration request for the transport parameter and frame types</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC8489">
        <front>
          <title>Session Traversal Utilities for NAT (STUN)</title>
          <author fullname="M. Petit-Huguenin" initials="M." surname="Petit-Huguenin"/>
          <author fullname="G. Salgueiro" initials="G." surname="Salgueiro"/>
          <author fullname="J. Rosenberg" initials="J." surname="Rosenberg"/>
          <author fullname="D. Wing" initials="D." surname="Wing"/>
          <author fullname="R. Mahy" initials="R." surname="Mahy"/>
          <author fullname="P. Matthews" initials="P." surname="Matthews"/>
          <date month="February" year="2020"/>
          <abstract>
            <t>Session Traversal Utilities for NAT (STUN) is a protocol that serves as a tool for other protocols in dealing with NAT traversal. It can be used by an endpoint to determine the IP address and port allocated to it by a NAT. It can also be used to check connectivity between two endpoints and as a keep-alive protocol to maintain NAT bindings. STUN works with many existing NATs and does not require any special behavior from them.</t>
            <t>STUN is not a NAT traversal solution by itself. Rather, it is a tool to be used in the context of a NAT traversal solution.</t>
            <t>This document obsoletes RFC 5389.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8489"/>
        <seriesInfo name="DOI" value="10.17487/RFC8489"/>
      </reference>
      <reference anchor="RFC9000">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author fullname="J. Iyengar" initials="J." role="editor" surname="Iyengar"/>
          <author fullname="M. Thomson" initials="M." role="editor" surname="Thomson"/>
          <date month="May" year="2021"/>
          <abstract>
            <t>This document defines the core of the QUIC transport protocol. QUIC provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances. Accompanying documents describe the integration of TLS for key negotiation, loss detection, and an exemplary congestion control algorithm.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9000"/>
        <seriesInfo name="DOI" value="10.17487/RFC9000"/>
      </reference>
      <reference anchor="RFC9287">
        <front>
          <title>Greasing the QUIC Bit</title>
          <author fullname="M. Thomson" initials="M." surname="Thomson"/>
          <date month="August" year="2022"/>
          <abstract>
            <t>This document describes a method for negotiating the ability to send an arbitrary value for the second-most significant bit in QUIC packets.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9287"/>
        <seriesInfo name="DOI" value="10.17487/RFC9287"/>
      </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>
    </references>
    <?line 200?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA61Y7XLbNhb9j6fAKj9qdyTGcjKpo+nHKraz9WxieWWlnU6n
44FISMKEIlgAlKP1pM+yz7JPtudekBRlO2l2dv9IJAjcL9x77gEGg4EIJuR6
JHv/eHdxKsdZ5rT38sz41G602/aEms+d3nxmQqqCXlq3HUkfMiEymxZqDYmZ
U4sw8FqvVVEMfq9MOlBx9SBrVg+OhsJX87Xx3tgibEusuzifvZbyiVS5t1Br
ikyXGj9F6PVlT2cmWGdUTi8X41f4sw5P09nrniiq9Vy7kchg0kiktvC68JUf
yeAqLeDEM6GcVpA6c6r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