<?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.18 (Ruby 3.3.3) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-quic-address-discovery-02" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.22.0 -->
  <front>
    <title abbrev="QUIC Address Discovery">QUIC Address Discovery</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-quic-address-discovery-02"/>
    <author fullname="Marten Seemann">
      <organization/>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="August" day="20"/>
    <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,
    [ IPv4 (32) ],
    [ IPv6 (128) ],
    Port (16),
}
]]></artwork>
        <t>The OBSERVED_ADDRESS frame contains the following fields:</t>
        <dl>
          <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.
Retransmissions <bcp14>MUST</bcp14> happen on the same path as the original frame was sent on.</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 196?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA61Y7W4bNxb9z6fgKj9qF9LEdoLUMfqxiu1sjU0sr6y0KIrC
oGYoiciInJIcOVojfZZ9ln2yPfdyZiTZTprF7h97hhre73vOJQeDgYgmlvpE
9v7x7uJUDovC6xDkmQm5W2m/7gk1nXq9+swHuYp67vz6RIZYCFG43KolJBZe
zeIgaL1U1g5+r00+UGn3oGh3Dw6ORKinSxOCcTauK+y7OJ+8lvKJVGVwUGts
oSuNPzb2+rKnCxOdN6qkl4vhK/xzHk/jyeuesPVyqv2JKGDSicidDdqGOpzI
6Gst4MQzobxWkDrxyobK+dgTt86/n3tXV42PPfFer7F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