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

<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 49?>

<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 (0x9f81a173) transport parameter (<xref section="7.4" sectionFormat="of" target="RFC9000"/>)
with an empty value. Implementations that understand this transport parameter
<bcp14>MUST</bcp14> treat the receipt of a non-empty value 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 frames 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 on the resumed connection.</t>
    </section>
    <section anchor="frames">
      <name>Frames</name>
      <t>This extension defines three frames. These frames <bcp14>MUST</bcp14> only appear in the
application data packet number space. These frames are "probing frames" as
defined in <xref section="9.1" sectionFormat="of" target="RFC9000"/>.</t>
      <section anchor="requestaddress">
        <name>REQUEST_ADDRESS</name>
        <artwork><![CDATA[
REQUEST_ADDRESS Frame {
    Type (i) = 0x9f81a0,
    Sequence Number (i),
}
]]></artwork>
        <t>The REQUEST_ADDRESS frame contains the following fields:</t>
        <dl>
          <dt>Sequence Number:</dt>
          <dd>
            <t>The sequence number of the request.</t>
          </dd>
        </dl>
        <t>REQUEST_ADDRESS frames are ack-eliciting. If lost, it's the sender's decision if
it wants to retransmit the frame. A sender <bcp14>MAY</bcp14> send a new REQUEST_ADDRESS frame
with an incremented sequence number instead.</t>
      </section>
      <section anchor="requestdeclined">
        <name>REQUEST_DECLINED</name>
        <artwork><![CDATA[
REQUEST_DECLINED Frame {
    Type (i) = 0x9f81a1,
    Sequence Number (i),
}
]]></artwork>
        <t>The REQUEST_DECLINED frame contains the following fields:</t>
        <dl>
          <dt>Sequence Number:</dt>
          <dd>
            <t>The sequence number of the request that is being declined.</t>
          </dd>
        </dl>
        <t>REQUEST_DECLINED frames are ack-eliciting, and <bcp14>SHOULD</bcp14> be retransmitted if lost.</t>
      </section>
      <section anchor="observedaddress">
        <name>OBSERVED_ADDRESS</name>
        <artwork><![CDATA[
OBSERVED_ADDRESS Frame {
    Type (i) = 0x9f81a2..0x9f81a3,
    Sequence Number (i),
    [ IPv4 (32) ],
    [ IPv6 (128) ],
    Port (16),
}
]]></artwork>
        <t>The OBSERVED_ADDRESS frame contains the following fields:</t>
        <dl>
          <dt>Sequence Number:</dt>
          <dd>
            <t>The sequence number 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>OBSERVED_ADDRESS frames are ack-eliciting, and <bcp14>SHOULD</bcp14> be retransmitted if lost.</t>
      </section>
    </section>
    <section anchor="address-discovery">
      <name>Address Discovery</name>
      <t>An endpoint that wishes to determine the remote address of a path sends a
REQUEST_ADDRESS frame on that path. The sequence number starts at 0 and is
incremented for any subsequent request. Since the REQUEST_ADDRESS frame is a
probing frame, the endpoint <bcp14>MAY</bcp14> bundle it with other probing frames during path
validation (<xref section="8.2" sectionFormat="of" target="RFC9000"/>).</t>
      <t>The receiver of the REQUEST_ADDRESS frame <bcp14>SHOULD</bcp14> report the observed address
using an OBSERVED_ADDRESS frame. The OBSERVED_ADDRESS frame does not need to be
sent on the same path, since the requester can associate the response with the
corresponding request using the sequence number.</t>
      <t>The receiver of a REQUEST_ADDRESS frame <bcp14>MAY</bcp14> decline to report the observed
address by sending a REQUEST_DECLINED frame. The REQUEST_DECLINED frame also
contains a sequence number, and therefore may be sent on any path.</t>
      <t>The sender <bcp14>MAY</bcp14> send a REQUEST_ADDRESS frame for the same path after a some time
has elapsed. This allows it to detect when a NAT rebinding has happened. To
speed up the discovery, it <bcp14>MAY</bcp14> also send another REQUEST_ADDRESS frame when the
peer changes the connection ID used on the path.</t>
      <t>When receiving an OBSERVED_ADDRESS or a REQUEST_DECLINED frame with a sequence
number value that was not previously sent in a REQUEST_ADDRESS frame, the
receiver <bcp14>MUST</bcp14> close the connection with a PROTOCOL_VIOLATION error code if it
can detect this condition.</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 use this
extension 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> enable support the
extension, or decline reporting the address using REQUEST_DECLINED frames.</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 227?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA7VZbW/bOBL+zl/Bcz80PdhOnBZtauybG7u7AdI457i7WCwW
ASXRNlFZVEXKqa/o/pb7LffL7pmhJMuJs7uHu/3SSrQ4L8/MPDNker2e8Man
eig7/3h/cS5HSVJo5+TYuNhudLHtCBVFhd78zgex8nppi+1QOp8Ikdg4U2tI
TAq18D2n9VplWe9jaeKeCrt7Sb27d3IiXBmtjXPGZn6bY9/FZP5WyidSpc5C
rckSnWv8k/lOV3Z0YrwtjErp5WL0Bv/ZAk+z+duOyMp1pIuhSGDSUMQ2czpz
pRtKX5RawInnQhVaQeq8UJnLbeE74s4WH5aFLfPKx474oLdYTIZC9iSt0P83
8/dX9P8DAMRGZyW0SbkvRMrgTucnyDfZUn5PP9P6WpkU64TId0b7Rd8WS1pX
RbzC+sr73A2Pj+kzWjIb3a8/O6aF46iwd04fk4Bj2rg0flVG2LpWhddZjfnx
n4kA7U8Bl/N7qtty+kF+39g/JfFPfdRf+XXaEc6rLLlVqc2A1FY74Uj17cfS
wqKhzKzIzVD+4m3clQ7RKvTC4Wm7podfhVClX9mCAgU3pFyUaRqSr/OOXZA3
wYoO/wwAVWb+qTxybSivCwu5NpWXKnL8u64iE9yvHPhuSav92K47QmS2WGP7
BvEWJlu03kSv15MQ5AsVeyHeZylliV/prVypjZa29D276EXwV37I7F2qk6Xu
cnpJZHduTeZd+DSzspFtMwjFXgFJppCZ9pSu0hlf8q99OScVmUaIdMGSZfhU
f/K6yFQqL65lBb8k5ZT0XXJEJjbYx5vMIrygPmRiCh37dCtRQRmedCI9fwu7
SKj2VHOtHSLSK9SpVPJqNCeTjKs8+0RAshdpiqSFb4l2JC3RkLQ2ma7Mzcso
NTGMFfeNlYACL9sgMVd+1a/gXpskSbUQT+RF5gublDF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