<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.9 -->
<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc-ext html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"?>
<rfc xmlns:x="http://purl.org/net/xml2rfc/ext"
     category="std"
     docName="draft-ietf-quic-spin-exp-latest"
     ipr="trust200902"
     submissionType="IETF">
   <x:feedback template="mailto:quic@ietf.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title abbrev="QUIC Spin Bit">The QUIC Latency Spin Bit</title>
      <author fullname="Brian Trammell"
              initials="B."
              role="editor"
              surname="Trammell">
         <organization>ETH Zurich</organization>
         <address>
            <email>ietf@trammell.ch</email>
         </address>
      </author>
      <author fullname="Mirja Kuehlewind" initials="M." surname="Kuehlewind">
         <organization>ETH Zurich</organization>
         <address>
            <email>mirja.kuehlewind@tik.ee.ethz.ch</email>
         </address>
      </author>
      <date/>
      <workgroup>QUIC</workgroup>
      <keyword>Internet-Draft</keyword>
      <abstract>
         <t>This document specifies the addition of a latency spin bit to the QUIC transport protocol and describes how to use it to measure end-to-end latency.</t>
      </abstract>
      <note title="Note to Readers">
         <t>This document specifies an experimental delta to the QUIC transport protocol. Specifically, this experimentation is intended to determine:</t>
         <t>
            <list style="symbols">
               <t>the impact of the addition of the latency spin bit on implementation and specification complexity; and</t>
               <t>the accuracy and value of the information derived from spin bit measurement on live network traffic.</t>
            </list>
         </t>
         <t>The information generated by this experiment will be used by the QUIC working group as input to a decision about the standardization of the latency spin bit. Although this is a Working Group document, it is currently NOT a Working Group deliverable.</t>
         <t>Discussion of this draft takes place on the QUIC working group mailing list (quic@ietf.org), which is archived at <eref target="https://mailarchive.ietf.org/arch/search/?email_list=quic">https://mailarchive.ietf.org/arch/search/?email_list=quic</eref>.</t>
         <t>Working Group information can be found at <eref target="https://github.com/quicwg">https://github.com/quicwg</eref>; source code and issues list for this draft can be found at <eref target="https://github.com/quicwg/base-drafts/labels/-spin">https://github.com/quicwg/base-drafts/labels/-spin</eref>.</t>
      </note>
   </front>
   <middle>
      <section anchor="introduction" title="Introduction">
         <t>The QUIC transport protocol <xref target="QUIC-TRANSPORT"/> uses Transport Layer Security (TLS) <xref target="TLS"/> to encrypt most of its protocol internals. In contrast to TCP where the sequence and acknowledgement numbers and timestamps (if the respective option is in use) can be seen by on-path observers and used to estimate end-to-end latency, QUIC’s wire image (see <xref target="WIRE-IMAGE"/>) currently does not expose any information that can be used for passive latency measurement techniques that rely on this information (e.g. <xref target="CACM-TCP"/>, <xref target="TMA-QOF"/>).</t>
         <t>This document adds an explicit signal for passive latency measurability to the QUIC short header: a “spin bit”. Passive observation of the spin bit provides one RTT sample per RTT to passive observers of QUIC traffic. This document describes the mechanism, how it can be added to QUIC, and how it can be used by passive measurement facilities to generate RTT samples.</t>
      </section>
      <section anchor="the-spin-bit-mechanism" title="The Spin Bit Mechanism">
         <t>The latency spin bit enables latency monitoring from observation points on the network path throughout the duration of a connection. Since it is possible to measure handshake RTT without a spin bit, it is sufficient to include the spin bit in the short packet header. The spin bit therefore appears only after version negotiation and connection establishment are completed.</t>
         <section anchor="header" title="Proposed Short Header Format Including Spin Bit">
            <t>
               <xref target="QUIC-TRANSPORT"/> specifies using the third most significant bit of the first byte in the short header for the spin bit (0x20, labeled S in <xref target="fig-short-header"/>). The Spin bit is set 0 or 1 depending on the stored spin value that is updated on packet reception as explained in <xref target="spinbit"/>.</t>
            <figure anchor="fig-short-header" title="Short Header Packet Format">
               <artwork>
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+
|0|1|S|R|R|K|P P|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                Destination Connection ID (0..144)           ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Packet Number (8/16/24/32)              ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Protected Payload (*)                   ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
            </figure>
         </section>
         <section anchor="spinbit" title="Setting the Spin Bit on Outgoing Packets">
            <t>Each endpoint, client and server, maintains a spin value, 0 or 1, for each QUIC connection, and sets the spin bit in the short header to the currently stored value when a packet with a short header is sent out. The spin value is initialized to 0 at each endpoint, client and server, at connection start. Each endpoint also remembers the highest packet number seen from its peer on the connection.</t>
            <t>The spin value is then determined at each endpoint within a single connection as follows:</t>
            <t>
               <list style="symbols">
                  <t>When the server receives a packet from the client, if that packet has a short header and if it increments the highest packet number seen by the server from the client, the server sets the spin value to the value observed in the spin bit in the received packet.</t>
                  <t>When the client receives a packet from the server, if the packet has a short header and if it increments the highest packet number seen by the client from the server, it sets the spin value to the opposite of the spin bit in the received packet.</t>
               </list>
            </t>
            <t>This procedure will cause the spin bit to change value in each direction once per round trip. Observation points can estimate the network latency by observing these changes in the latency spin bit, as described in <xref target="usage"/>. See <xref target="QUIC-SPIN"/> for further illustration of this mechanism in action.</t>
         </section>
         <section anchor="state-reset" title="Resetting Spin Value State">
            <t>Each client and server resets it spin value to zero when sending the first packet of a given connection with a new connection ID. This reduces the risk that transient spin bit state can be used to link flows across connection migration or ID change.</t>
         </section>
      </section>
      <section anchor="usage" title="Using the Spin Bit for Passive RTT Measurement">
         <t>When a QUIC flow sends data continuously, the latency spin bit in each direction changes value once per round-trip time (RTT). An on-path observer can observe the time difference between edges (changes from 1 to 0 or 0 to 1) in the spin bit signal in a single direction to measure one sample of end-to-end RTT.</t>
         <t>Note that this measurement, as with passive RTT measurement for TCP, includes any transport protocol delay (e.g., delayed sending of acknowledgements) and/or application layer delay (e.g., waiting for a request to complete). It therefore provides devices on path a good instantaneous estimate of the RTT as experienced by the application. A simple linear smoothing or moving minimum filter can be applied to the stream of RTT information to get a more stable estimate.</t>
         <t>However, application-limited and flow-control-limited senders can have application and transport layer delay, respectively, that are much greater than network RTT. When the sender is application-limited and e.g. only sends small amount of periodic application traffic, where that period is longer than the RTT, measuring the spin bit provides information about the application period, not the network RTT.</t>
         <t>Simple heuristics based on the observed data rate per flow or changes in the RTT series can be used to reject bad RTT samples due to lost or reordered edges in the spin signal, as well as application or flow control limitation; for example, QoF <xref target="TMA-QOF"/> rejects component RTTs significantly higher than RTTs over the history of the flow. These heuristics may use the handshake RTT as an initial RTT estimate for a given flow.</t>
         <t>An on-path observer that can see traffic in both directions (from client to server and from server to client) can also use the spin bit to measure “upstream” and “downstream” component RTT; i.e, the component of the end-to-end RTT attributable to the paths between the observer and the server and the observer and the client, respectively. It does this by measuring the delay between a spin edge observed in the upstream direction and that observed in the downstream direction, and vice versa.</t>
      </section>
      <section anchor="disabling-the-spin-bit" title="Disabling the Spin Bit">
         <t>Implementations SHOULD allow administrators of clients and servers to disable the spin bit either globally or on a per-connection basis. Even when the spin bit is not disabled by the administrator implementations SHOULD disable the spin bit on a randomly chosen fraction of connections.</t>
         <t>The selection process SHOULD be designed such that on average the spin bit is disabled for at least one eighth of network paths. The selection process SHOULD be externally unpredictable but consistent for any given combination of source and destination address/port. For instance, the implementation might have a static key which it uses to key a pseudorandom function over these values and use the output to determine whether to send the spin bit. The selection process performed at the beginning of the connection SHOULD be applied for all paths used by the connection.</t>
         <t>Note that where multiple connections use the same path, the use of the spin bit MAY be coordinated by endpoints, recognizing that this might not be possible in many cases.</t>
         <t>When the spin bit is disabled, endpoints MAY set the spin bit to any value, and MUST accept any incoming value. It is RECOMMENDED that they set the spin bit to a random value either chosen independently for each packet, or chosen independently for each path and kept constant for that path.</t>
      </section>
      <section anchor="iana-considerations" title="IANA Considerations">
         <t>This document has no actions for IANA.</t>
      </section>
      <section anchor="security-and-privacy-considerations"
               title="Security and Privacy Considerations">
         <t>The spin bit is intended to expose end-to-end RTT to observers along the path, so the privacy considerations for the latency spin bit are essentially the same as those for passive RTT measurement in general. It has been shown <xref target="PAM-RTT"/> that RTT measurements do not provide more information for geolocation than is available in the most basic, freely-available IP address based location databases. The risk of exposure of per-flow network RTT to on-path devices is in most cases negligible.</t>
         <t>There is however an exception, when parts of the path from client to server are hidden from observers. An example would be a server accessed through a proxy. The spin bit allows for measurement of the end-to-end RTT, and will thus enable adversaries near the endpoint to discover that the connection does not terminate at the visible destination address.</t>
         <t>Endpoints that want to hide their use of a proxy or a relay will want to disable the spin bit. However, if only privacy-sensitive clients or servers ever disabled the spin bit, they would stick out. The probabilistic disabling behavior explained in <xref target="disabling-the-spin-bit"/> ensures that other endpoints will also disable the spin bit some of the time, thus hiding the privacy sensitive endpoints in a large anonymity set. It also provides for a minimal greasing of the spin bit, in order to mitigate risks of ossification.</t>
      </section>
      <section anchor="change-log" title="Change Log">
         <t>
            <list style="empty">
               <t>
                  <spanx style="strong">RFC Editor’s Note:</spanx> Please remove this section prior to publication of a final version of this document.</t>
            </list>
         </t>
         <section anchor="since-draft-ietf-spin-exp-00"
                  title="Since draft-ietf-spin-exp-00">
            <t>Adding section on disabling the spin bit and privacy considerations.</t>
         </section>
      </section>
      <section anchor="acknowledgments" numbered="false" title="Acknowledgments">
         <t>This document is derived from <xref target="QUIC-SPIN"/>, which was the work of the following authors in addition to the editor of this document:</t>
         <t>
            <list style="symbols">
               <t>Piet De Vaere, ETH Zurich</t>
               <t>Roni Even, Huawei</t>
               <t>Giuseppe Fioccola, Telecom Italia</t>
               <t>Thomas Fossati, Nokia</t>
               <t>Marcus Ihlar, Ericsson</t>
               <t>Al Morton, AT&amp;T Labs</t>
               <t>Emile Stephan, Orange</t>
            </list>
         </t>
         <t>The QUIC Spin Bit was originally specified in a slightly different form by Christian Huitema.</t>
         <t>This work is partially supported by the European Commission under Horizon 2020 grant agreement no. 688421 Measurement and Architecture for a Middleboxed Internet (MAMI), and by the Swiss State Secretariat for Education, Research, and Innovation under contract no. 15.0268. This support does not imply endorsement.</t>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <reference anchor="QUIC-TRANSPORT">
            <front>
               <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
               <author fullname="Jana Iyengar"
                       initials="J."
                       role="editor"
                       surname="Iyengar">
                  <organization>Fastly</organization>
               </author>
               <author fullname="Martin Thomson"
                       initials="M."
                       role="editor"
                       surname="Thomson">
                  <organization>Mozilla</organization>
               </author>
               <date/>
            </front>
            <seriesInfo name="Internet-Draft" value="draft-ietf-quic-transport-latest"/>
            <x:source basename="draft-ietf-quic-transport-latest"
                      href="draft-ietf-quic-transport-latest.xml"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="CACM-TCP">
            <front>
               <title>Passively Measuring TCP Round-Trip Times (in Communications of the ACM)</title>
               <author initials="S." surname="Strowes"/>
               <date month="October" year="2013"/>
            </front>
         </reference>
         <reference anchor="TMA-QOF">
            <front>
               <title>Inline Data Integrity Signals for Passive Measurement (in Proc. TMA 2014)</title>
               <author initials="B." surname="Trammell"/>
               <author initials="D." surname="Gugelmann"/>
               <author initials="N." surname="Brownlee"/>
               <date month="April" year="2014"/>
            </front>
         </reference>
         <reference anchor="PAM-RTT">
            <front>
               <title>Revisiting the Privacy Implications of Two-Way Internet Latency Data (in Proc. PAM 2018)</title>
               <author initials="B." surname="Trammell"/>
               <author initials="M." surname="Kuehlewind"/>
               <date month="March" year="2018"/>
            </front>
         </reference>
         <reference anchor="TLS">
            <front>
               <title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
               <author fullname="E. Rescorla" initials="E." surname="Rescorla"/>
               <date month="August" year="2018"/>
            </front>
            <seriesInfo name="RFC" value="8446"/>
            <seriesInfo name="DOI" value="10.17487/RFC8446"/>
         </reference>
         <reference anchor="WIRE-IMAGE">
            <front>
               <title>The Wire Image of a Network Protocol</title>
               <author fullname="Brian Trammell" initials="B" surname="Trammell"/>
               <author fullname="Mirja Kuehlewind" initials="M" surname="Kuehlewind"/>
               <date day="10" month="April" year="2018"/>
            </front>
            <seriesInfo name="Internet-Draft" value="draft-trammell-wire-image-04"/>
         </reference>
         <reference anchor="QUIC-SPIN">
            <front>
               <title>Adding Explicit Passive Measurability of Two-Way Latency to the QUIC Transport Protocol</title>
               <author fullname="Brian Trammell" initials="B" surname="Trammell"/>
               <author fullname="Piet Vaere" initials="P" surname="Vaere"/>
               <author fullname="Roni Even" initials="R" surname="Even"/>
               <author fullname="Giuseppe Fioccola" initials="G" surname="Fioccola"/>
               <author fullname="Thomas Fossati" initials="T" surname="Fossati"/>
               <author fullname="Marcus Ihlar" initials="M" surname="Ihlar"/>
               <author fullname="Alfred Morton" initials="A" surname="Morton"/>
               <author fullname="Stephan Emile" initials="S" surname="Emile"/>
               <date day="14" month="May" year="2018"/>
            </front>
            <seriesInfo name="Internet-Draft" value="draft-trammell-quic-spin-03"/>
         </reference>
      </references>
   </back>
</rfc>
