<?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.29 (Ruby 3.4.4) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-masque-connect-udp-ecn-01" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.29.0 -->
  <front>
    <title abbrev="CONNECT-UDP ECN">Using ECN when Proxying UDP in HTTP</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-masque-connect-udp-ecn-01"/>
    <author fullname="Marten Seemann">
      <organization>Smallstep</organization>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2025" month="July" day="07"/>
    <area>Web and Internet Transport</area>
    <workgroup>Multiplexed Application Substrate over QUIC Encryption</workgroup>
    <keyword>UDP</keyword>
    <keyword>ECN</keyword>
    <keyword>Proxying</keyword>
    <abstract>
      <?line 37?>

<t>This document describes how to proxy the ECN bits when proxying UDP in HTTP.</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-masque-connect-udp-ecn/draft-seemann-masque-connect-udp-ecn.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-seemann-masque-connect-udp-ecn/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        Multiplexed Application Substrate over QUIC Encryption Working Group mailing list (<eref target="mailto:masque@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/masque/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/masque/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/marten-seemann/draft-seemann-masque-connect-udp-ecn"/>.</t>
    </note>
  </front>
  <middle>
    <?line 41?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>Explicit Congestion Notification marking <xref target="RFC3168"/> uses two bits in the IP
header to signal congestion from a network to endpoints.</t>
      <t><xref target="RFC9298"/> describes how UDP datagrams can be proxied in HTTP. This allows the
proxying of the payload of UDP datagrams, however, it is not possible to proxy
the ECN bits. This document defines an extension to <xref target="RFC9298"/> that allows the
proxying of the ECN bits without imposing any encoding overhead.</t>
      <t>When establishing a tunnel, the client registers four context identifiers, one
for each ECN marking. These context identifiers are then used to:</t>
      <ol spacing="normal" type="1"><li>
          <t>For UDP datagrams sent from the client to the proxy: To request the proxy to
set the ECN marking on the UDP datagram sent to the target.</t>
        </li>
        <li>
          <t>For UDP datagrams sent from the proxy to the client: To inform the client
about the ECN marking of the UDP datagram received from the target.</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="proxying-ecn">
      <name>Proxying ECN</name>
      <t>The proxy fulfills a dual role: First, it sends UDP datagrams received from the
client over HTTP to the target, and sends UDP datagrams received from the target
over HTTP to the client. Second, it also acts as a router that can experience
congestion in both directions.</t>
      <section anchor="sending-udp-datagrams-from-the-client-to-the-proxy">
        <name>Sending UDP datagrams from the client to the proxy</name>
        <t>When sending UDP datagrams over the tunnel, the client uses the context
identifier as negotiated during establishment of the tunnel (see
<xref target="negotiation"/>). Under normal circumstances, the proxy <bcp14>MUST</bcp14> set the ECN marking
on the UDP datagram sent to the target based on the context identifier. However,
if the proxy is experiencing congestion on the link to the target, it <bcp14>SHOULD</bcp14>
apply ECN markings according to <xref target="RFC3168"/> and <xref target="RFC8331"/>.</t>
      </section>
      <section anchor="sending-udp-datagrams-from-the-proxy-to-the-client">
        <name>Sending UDP datagrams from the proxy to the client</name>
        <t>When receiving UDP datagrams from the target, the proxy uses the context
identifier negotiated during establishment of the tunnel to indicate the ECN
marking the UDP datagram was received with. Similarly, if the HTTP connection to
the client is experiencing congestion, the proxy <bcp14>SHOULD</bcp14> apply ECN markings.</t>
      </section>
    </section>
    <section anchor="negotiation">
      <name>Negotiating Extension and Registration of Context Identifiers</name>
      <t>To support ECN mode, both clients and proxies need to include the "Proxy-ECN"
header field. This indicates support for ECN mode and registers the context
IDs.</t>
      <artwork><![CDATA[
proxy-ecn = ?1; ect1 = 100; ect0 = 1234; ce = 42
]]></artwork>
      <t>"Proxy-ECN" is an Item Structured Header <xref target="RFC8941"/>. Its value <bcp14>MUST</bcp14> be a
boolean.</t>
      <t>If the client wants to enable proxying of ECN markings, it sets the value to
"?1". The client <bcp14>MUST</bcp14> add the following three parameters: "ect1", "ect0", and
"ce", each of which is of type sf-integer. The Not-ECT context ID always uses
context ID 0. The values are used to register the context IDs for the different
ECN markings. The numbers <bcp14>MUST</bcp14> be even according to the rules for context
identifiers in Section 4 of <xref target="RFC9298"/>.</t>
      <t>It is <bcp14>RECOMMENDED</bcp14> to use context identifier values that can be encoded using the
same QUIC Variable-Length Integer encoding (see Section 16 of <xref target="RFC9000"/>).</t>
      <t>If the proxy wants to enable proxying of ECN markings, it sets the value to
"?1". It <bcp14>MUST NOT</bcp14> add any of the four parameters defined above.</t>
      <t>If the proxy wants to disable proxying of ECN markings, it either omits the
"Proxy-ECN" header field or sets the value to "?0". This also refuses the
registration of the context IDs.</t>
      <section anchor="optimistic-sending-of-ecn-markings">
        <name>Optimistic Sending of ECN Markings</name>
        <t><xref target="RFC9298"/> allows the client to send UDP datagrams to the proxy without
waiting for the proxy to send a response. This is useful for applications that
need to send UDP datagrams to the proxy as soon as possible.</t>
        <t>When sending datagrams to the proxy, the client <bcp14>MAY</bcp14> optimistically use the
context identifiers proposed in the "Proxy-ECN" header field. However, these
datagrams will be dropped if the server does not enable ECN mode. This is
therefore only recommended if the client has prior knowledge that the server
likely supports ECN mode.</t>
        <t>A client that wishes to avoid the loss of packets if ECN mode is not enabled
<bcp14>SHOULD NOT</bcp14> optimistically use the context identifiers proposed in the
"Proxy-ECN" header field.</t>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC3168">
        <front>
          <title>The Addition of Explicit Congestion Notification (ECN) to IP</title>
          <author fullname="K. Ramakrishnan" initials="K." surname="Ramakrishnan"/>
          <author fullname="S. Floyd" initials="S." surname="Floyd"/>
          <author fullname="D. Black" initials="D." surname="Black"/>
          <date month="September" year="2001"/>
          <abstract>
            <t>This memo specifies the incorporation of ECN (Explicit Congestion Notification) to TCP and IP, including ECN's use of two bits in the IP header. [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="3168"/>
        <seriesInfo name="DOI" value="10.17487/RFC3168"/>
      </reference>
      <reference anchor="RFC9298">
        <front>
          <title>Proxying UDP in HTTP</title>
          <author fullname="D. Schinazi" initials="D." surname="Schinazi"/>
          <date month="August" year="2022"/>
          <abstract>
            <t>This document describes how to proxy UDP in HTTP, similar to how the HTTP CONNECT method allows proxying TCP in HTTP. More specifically, this document defines a protocol that allows an HTTP client to create a tunnel for UDP communications through an HTTP server that acts as a proxy.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9298"/>
        <seriesInfo name="DOI" value="10.17487/RFC9298"/>
      </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>
      <reference anchor="RFC8331">
        <front>
          <title>RTP Payload for Society of Motion Picture and Television Engineers (SMPTE) ST 291-1 Ancillary Data</title>
          <author fullname="T. Edwards" initials="T." surname="Edwards"/>
          <date month="February" year="2018"/>
          <abstract>
            <t>This memo describes a Real-time Transport Protocol (RTP) payload format for the Society of Motion Picture and Television Engineers (SMPTE) ancillary space (ANC) data, as defined by SMPTE ST 291-1. SMPTE ANC data is generally used along with professional video formats to carry a range of ancillary data types, including time code, Closed Captioning, and the Active Format Description (AFD).</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8331"/>
        <seriesInfo name="DOI" value="10.17487/RFC8331"/>
      </reference>
      <reference anchor="RFC8941">
        <front>
          <title>Structured Field Values for HTTP</title>
          <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
          <author fullname="P-H. Kamp" surname="P-H. Kamp"/>
          <date month="February" year="2021"/>
          <abstract>
            <t>This document describes a set of data types and associated algorithms that are intended to make it easier and safer to define and handle HTTP header and trailer fields, known as "Structured Fields", "Structured Headers", or "Structured Trailers". It is intended for use by specifications of new HTTP fields that wish to use a common syntax that is more restrictive than traditional HTTP field values.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8941"/>
        <seriesInfo name="DOI" value="10.17487/RFC8941"/>
      </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>
    </references>
    <?line 161?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA61Y23IbuRF9x1cg9EuSEilRUm1s7kWrSHLEKt1iUXFtpfIA
zmBIlIbALIARzbj0L/st+2U5DcxVpG2lkifOYIC+nj7d4HA4ZF75XE744MEp
veAXZzd8vZSa31nzaUMrD+d3XGl+OZvdDZiYz618wu6z25ubi7PZkL7izIAl
wsuFsZsJdz5lLDWJFivITa3I/NBJuRJaD1fC/VrKYWK0lokflmkxlIkeHoyZ
K+cr5Zwy2m8KnJtezN4zXa7m0k5YCuEThlNOale6Cfe2lAx2HDFhpYA9H+Wc
C53yqfbSaun5zArtCm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