QUIC J. Iyengar, Ed.
Internet-Draft Google
Intended status: Standards Track M. Thomson, Ed.
Expires: April 16, 2018 Mozilla
October 13, 2017
QUIC: A UDP-Based Multiplexed and Secure Transport
draft-ietf-quic-transport-07
Abstract
This document defines the core of the QUIC transport protocol. This
document describes connection establishment, packet format,
multiplexing and reliability. Accompanying documents describe the
cryptographic handshake and loss detection.
Note to Readers
Discussion of this draft takes place on the QUIC working group
mailing list (quic@ietf.org), which is archived at
https://mailarchive.ietf.org/arch/search/?email_list=quic [1].
Working Group information can be found at https://github.com/quicwg
[2]; source code and issues list for this draft can be found at
https://github.com/quicwg/base-drafts/labels/transport [3].
Status of This Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 16, 2018.
Iyengar & Thomson Expires April 16, 2018 [Page 1]
Internet-Draft QUIC Transport Protocol October 2017
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4
2. Conventions and Definitions . . . . . . . . . . . . . . . . . 5
2.1. Notational Conventions . . . . . . . . . . . . . . . . . 5
3. A QUIC Overview . . . . . . . . . . . . . . . . . . . . . . . 6
3.1. Low-Latency Connection Establishment . . . . . . . . . . 6
3.2. Stream Multiplexing . . . . . . . . . . . . . . . . . . . 6
3.3. Rich Signaling for Congestion Control and Loss Recovery . 7
3.4. Stream and Connection Flow Control . . . . . . . . . . . 7
3.5. Authenticated and Encrypted Header and Payload . . . . . 7
3.6. Connection Migration and Resilience to NAT Rebinding . . 8
3.7. Version Negotiation . . . . . . . . . . . . . . . . . . . 8
4. Versions . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5. Packet Types and Formats . . . . . . . . . . . . . . . . . . 9
5.1. Long Header . . . . . . . . . . . . . . . . . . . . . . . 9
5.2. Short Header . . . . . . . . . . . . . . . . . . . . . . 11
5.3. Version Negotiation Packet . . . . . . . . . . . . . . . 13
5.4. Cleartext Packets . . . . . . . . . . . . . . . . . . . . 13
5.4.1. Client Initial Packet . . . . . . . . . . . . . . . . 14
5.4.2. Server Stateless Retry Packet . . . . . . . . . . . . 14
5.4.3. Server Cleartext Packet . . . . . . . . . . . . . . . 15
5.4.4. Client Cleartext Packet . . . . . . . . . . . . . . . 15
5.5. Protected Packets . . . . . . . . . . . . . . . . . . . . 16
5.6. Connection ID . . . . . . . . . . . . . . . . . . . . . . 16
5.7. Packet Numbers . . . . . . . . . . . . . . . . . . . . . 17
5.7.1. Initial Packet Number . . . . . . . . . . . . . . . . 18
5.8. Handling Packets from Different Versions . . . . . . . . 18
6. Frames and Frame Types . . . . . . . . . . . . . . . . . . . 19
7. Life of a Connection . . . . . . . . . . . . . . . . . . . . 20
7.1. Matching Packets to Connections . . . . . . . . . . . . . 21
7.2. Version Negotiation . . . . . . . . . . . . . . . . . . . 22
7.2.1. Sending Version Negotiation Packets . . . . . . . . . 22
Iyengar & Thomson Expires April 16, 2018 [Page 2]
Internet-Draft QUIC Transport Protocol October 2017
7.2.2. Handling Version Negotiation Packets . . . . . . . . 23
7.2.3. Using Reserved Versions . . . . . . . . . . . . . . . 23
7.3. Cryptographic and Transport Handshake . . . . . . . . . . 24
7.4. Transport Parameters . . . . . . . . . . . . . . . . . . 25
7.4.1. Transport Parameter Definitions . . . . . . . . . . . 27
7.4.2. Values of Transport Parameters for 0-RTT . . . . . . 28
7.4.3. New Transport Parameters . . . . . . . . . . . . . . 28
7.4.4. Version Negotiation Validation . . . . . . . . . . . 29
7.5. Stateless Retries . . . . . . . . . . . . . . . . . . . . 30
7.6. Proof of Source Address Ownership . . . . . . . . . . . . 31
7.6.1. Client Address Validation Procedure . . . . . . . . . 31
7.6.2. Address Validation on Session Resumption . . . . . . 32
7.6.3. Address Validation Token Integrity . . . . . . . . . 33
7.7. Connection Migration . . . . . . . . . . . . . . . . . . 33
7.7.1. Privacy Implications of Connection Migration . . . . 33
7.7.2. Address Validation for Migrated Connections . . . . . 35
7.8. Connection Termination . . . . . . . . . . . . . . . . . 35
7.8.1. Draining Period . . . . . . . . . . . . . . . . . . . 35
7.8.2. Idle Timeout . . . . . . . . . . . . . . . . . . . . 35
7.8.3. Immediate Close . . . . . . . . . . . . . . . . . . . 36
7.8.4. Stateless Reset . . . . . . . . . . . . . . . . . . . 36
8. Frame Types and Formats . . . . . . . . . . . . . . . . . . . 39
8.1. PADDING Frame . . . . . . . . . . . . . . . . . . . . . . 39
8.2. RST_STREAM Frame . . . . . . . . . . . . . . . . . . . . 39
8.3. CONNECTION_CLOSE frame . . . . . . . . . . . . . . . . . 40
8.4. APPLICATION_CLOSE frame . . . . . . . . . . . . . . . . . 41
8.5. MAX_DATA Frame . . . . . . . . . . . . . . . . . . . . . 41
8.6. MAX_STREAM_DATA Frame . . . . . . . . . . . . . . . . . . 42
8.7. MAX_STREAM_ID Frame . . . . . . . . . . . . . . . . . . . 43
8.8. PING frame . . . . . . . . . . . . . . . . . . . . . . . 43
8.9. BLOCKED Frame . . . . . . . . . . . . . . . . . . . . . . 44
8.10. STREAM_BLOCKED Frame . . . . . . . . . . . . . . . . . . 44
8.11. STREAM_ID_BLOCKED Frame . . . . . . . . . . . . . . . . . 44
8.12. NEW_CONNECTION_ID Frame . . . . . . . . . . . . . . . . . 45
8.13. STOP_SENDING Frame . . . . . . . . . . . . . . . . . . . 45
8.14. ACK Frame . . . . . . . . . . . . . . . . . . . . . . . . 46
8.14.1. ACK Block Section . . . . . . . . . . . . . . . . . 48
8.14.2. ACK Frames and Packet Protection . . . . . . . . . . 50
8.15. STREAM Frame . . . . . . . . . . . . . . . . . . . . . . 51
9. Packetization and Reliability . . . . . . . . . . . . . . . . 52
9.1. Special Considerations for PMTU Discovery . . . . . . . . 55
10. Streams: QUIC's Data Structuring Abstraction . . . . . . . . 55
10.1. Stream Identifiers . . . . . . . . . . . . . . . . . . . 56
10.2. Life of a Stream . . . . . . . . . . . . . . . . . . . . 56
10.2.1. idle . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.2. open . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.3. half-closed (local) . . . . . . . . . . . . . . . . 59
10.2.4. half-closed (remote) . . . . . . . . . . . . . . . . 59
Iyengar & Thomson Expires April 16, 2018 [Page 3]
Internet-Draft QUIC Transport Protocol October 2017
10.2.5. closed . . . . . . . . . . . . . . . . . . . . . . . 60
10.3. Solicited State Transitions . . . . . . . . . . . . . . 60
10.4. Stream Concurrency . . . . . . . . . . . . . . . . . . . 61
10.5. Sending and Receiving Data . . . . . . . . . . . . . . . 62
10.6. Stream Prioritization . . . . . . . . . . . . . . . . . 62
11. Flow Control . . . . . . . . . . . . . . . . . . . . . . . . 63
11.1. Edge Cases and Other Considerations . . . . . . . . . . 64
11.1.1. Response to a RST_STREAM . . . . . . . . . . . . . . 65
11.1.2. Data Limit Increments . . . . . . . . . . . . . . . 65
11.2. Stream Limit Increment . . . . . . . . . . . . . . . . . 66
11.2.1. Blocking on Flow Control . . . . . . . . . . . . . . 66
11.3. Stream Final Offset . . . . . . . . . . . . . . . . . . 66
12. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 67
12.1. Connection Errors . . . . . . . . . . . . . . . . . . . 67
12.2. Stream Errors . . . . . . . . . . . . . . . . . . . . . 68
12.3. Transport Error Codes . . . . . . . . . . . . . . . . . 68
12.4. Application Protocol Error Codes . . . . . . . . . . . . 70
13. Security and Privacy Considerations . . . . . . . . . . . . . 70
13.1. Spoofed ACK Attack . . . . . . . . . . . . . . . . . . . 70
13.2. Slowloris Attacks . . . . . . . . . . . . . . . . . . . 70
13.3. Stream Fragmentation and Reassembly Attacks . . . . . . 71
13.4. Stream Commitment Attack . . . . . . . . . . . . . . . . 71
14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 72
14.1. QUIC Transport Parameter Registry . . . . . . . . . . . 72
14.2. QUIC Transport Error Codes Registry . . . . . . . . . . 73
15. References . . . . . . . . . . . . . . . . . . . . . . . . . 75
15.1. Normative References . . . . . . . . . . . . . . . . . . 75
15.2. Informative References . . . . . . . . . . . . . . . . . 76
15.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Appendix A. Contributors . . . . . . . . . . . . . . . . . . . . 77
Appendix B. Acknowledgments . . . . . . . . . . . . . . . . . . 77
Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 78
C.1. Since draft-ietf-quic-transport-06 . . . . . . . . . . . 78
C.2. Since draft-ietf-quic-transport-05 . . . . . . . . . . . 78
C.3. Since draft-ietf-quic-transport-04 . . . . . . . . . . . 78
C.4. Since draft-ietf-quic-transport-03 . . . . . . . . . . . 79
C.5. Since draft-ietf-quic-transport-02 . . . . . . . . . . . 79
C.6. Since draft-ietf-quic-transport-01 . . . . . . . . . . . 80
C.7. Since draft-ietf-quic-transport-00 . . . . . . . . . . . 82
C.8. Since draft-hamilton-quic-transport-protocol-01 . . . . . 82
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 82
1. Introduction
QUIC is a multiplexed and secure transport protocol that runs on top
of UDP. QUIC aims to provide a flexible set of features that allow
it to be a general-purpose transport for multiple applications.
Iyengar & Thomson Expires April 16, 2018 [Page 4]
Internet-Draft QUIC Transport Protocol October 2017
QUIC implements techniques learned from experience with TCP, SCTP and
other transport protocols. QUIC uses UDP as substrate so as to not
require changes to legacy client operating systems and middleboxes to
be deployable. QUIC authenticates all of its headers and encrypts
most of the data it exchanges, including its signaling. This allows
the protocol to evolve without incurring a dependency on upgrades to
middleboxes. This document describes the core QUIC protocol,
including the conceptual design, wire format, and mechanisms of the
QUIC protocol for connection establishment, stream multiplexing,
stream and connection-level flow control, and data reliability.
Accompanying documents describe QUIC's loss detection and congestion
control [QUIC-RECOVERY], and the use of TLS 1.3 for key negotiation
[QUIC-TLS].
2. Conventions and Definitions
The words "MUST", "MUST NOT", "SHOULD", and "MAY" are used in this
document. It's not shouting; when they are capitalized, they have
the special meaning defined in [RFC2119].
Definitions of terms that are used in this document:
Client: The endpoint initiating a QUIC connection.
Server: The endpoint accepting incoming QUIC connections.
Endpoint: The client or server end of a connection.
Stream: A logical, bi-directional channel of ordered bytes within a
QUIC connection.
Connection: A conversation between two QUIC endpoints with a single
encryption context that multiplexes streams within it.
Connection ID: The 64-bit unsigned number used as an identifier for
a QUIC connection.
QUIC packet: A well-formed UDP payload that can be parsed by a QUIC
receiver. QUIC packet size in this document refers to the UDP
payload size.
2.1. Notational Conventions
Packet and frame diagrams use the format described in Section 3.1 of
[RFC2360], with the following additional conventions:
[x] Indicates that x is optional
Iyengar & Thomson Expires April 16, 2018 [Page 5]
Internet-Draft QUIC Transport Protocol October 2017
{x} Indicates that x is encrypted
x (A) Indicates that x is A bits long
x (A/B/C) ... Indicates that x is one of A, B, or C bits long
x (*) ... Indicates that x is variable-length
3. A QUIC Overview
This section briefly describes QUIC's key mechanisms and benefits.
Key strengths of QUIC include:
o Low-latency connection establishment
o Multiplexing without head-of-line blocking
o Authenticated and encrypted header and payload
o Rich signaling for congestion control and loss recovery
o Stream and connection flow control
o Connection migration and resilience to NAT rebinding
o Version negotiation
3.1. Low-Latency Connection Establishment
QUIC relies on a combined cryptographic and transport handshake for
setting up a secure transport connection. QUIC connections are
expected to commonly use 0-RTT handshakes, meaning that for most QUIC
connections, data can be sent immediately following the client
handshake packet, without waiting for a reply from the server. QUIC
provides a dedicated stream (Stream ID 0) to be used for performing
the cryptographic handshake and QUIC options negotiation. The format
of the QUIC options and parameters used during negotiation are
described in this document, but the handshake protocol that runs on
Stream ID 0 is described in the accompanying cryptographic handshake
draft [QUIC-TLS].
3.2. Stream Multiplexing
When application messages are transported over TCP, independent
application messages can suffer from head-of-line blocking. When an
application multiplexes many streams atop TCP's single-bytestream
abstraction, a loss of a TCP segment results in blocking of all
subsequent segments until a retransmission arrives, irrespective of
Iyengar & Thomson Expires April 16, 2018 [Page 6]
Internet-Draft QUIC Transport Protocol October 2017
the application streams that are encapsulated in subsequent segments.
QUIC ensures that lost packets carrying data for an individual stream
only impact that specific stream. Data received on other streams can
continue to be reassembled and delivered to the application.
3.3. Rich Signaling for Congestion Control and Loss Recovery
QUIC's packet framing and acknowledgments carry rich information that
help both congestion control and loss recovery in fundamental ways.
Each QUIC packet carries a new packet number, including those
carrying retransmitted data. This obviates the need for a separate
mechanism to distinguish acknowledgments for retransmissions from
those for original transmissions, avoiding TCP's retransmission
ambiguity problem. QUIC acknowledgments also explicitly encode the
delay between the receipt of a packet and its acknowledgment being
sent, and together with the monotonically-increasing packet numbers,
this allows for precise network roundtrip-time (RTT) calculation.
QUIC's ACK frames support up to 256 ACK blocks, so QUIC is more
resilient to reordering than TCP with SACK support, as well as able
to keep more bytes on the wire when there is reordering or loss.
3.4. Stream and Connection Flow Control
QUIC implements stream- and connection-level flow control. At a high
level, a QUIC receiver advertises the maximum amount of data that it
is willing to receive on each stream. As data is sent, received, and
delivered on a particular stream, the receiver sends MAX_STREAM_DATA
frames that increase the advertised limit for that stream, allowing
the peer to send more data on that stream.
In addition to this stream-level flow control, QUIC implements
connection-level flow control to limit the aggregate buffer that a
QUIC receiver is willing to allocate to all streams on a connection.
Connection-level flow control works in the same way as stream-level
flow control, but the bytes delivered and the limits are aggregated
across all streams.
3.5. Authenticated and Encrypted Header and Payload
TCP headers appear in plaintext on the wire and are not
authenticated, causing a plethora of injection and header
manipulation issues for TCP, such as receive-window manipulation and
sequence-number overwriting. While some of these are mechanisms used
by middleboxes to improve TCP performance, others are active attacks.
Even "performance-enhancing" middleboxes that routinely interpose on
the transport state machine end up limiting the evolvability of the
transport protocol, as has been observed in the design of MPTCP
[RFC6824] and in its subsequent deployability issues.
Iyengar & Thomson Expires April 16, 2018 [Page 7]
Internet-Draft QUIC Transport Protocol October 2017
Generally, QUIC packets are always authenticated and the payload is
typically fully encrypted. The parts of the packet header which are
not encrypted are still authenticated by the receiver, so as to
thwart any packet injection or manipulation by third parties. Some
early handshake packets, such as the Version Negotiation packet, are
not encrypted, but information sent in these unencrypted handshake
packets is later verified as part of cryptographic processing.
3.6. Connection Migration and Resilience to NAT Rebinding
QUIC connections are identified by a Connection ID, a 64-bit unsigned
number randomly generated by the server. QUIC's consistent
connection ID allows connections to survive changes to the client's
IP and port, such as those caused by NAT rebindings or by the client
changing network connectivity to a new address. QUIC provides
automatic cryptographic verification of a rebound lient, since the
client continues to use the same session key for encrypting and
decrypting packets. The consistent connection ID can be used to
allow migration of the connection to a new server IP address as well,
since the Connection ID remains consistent across changes in the
client's and the server's network addresses.
3.7. Version Negotiation
QUIC version negotiation allows for multiple versions of the protocol
to be deployed and used concurrently. Version negotiation is
described in Section 7.2.
4. Versions
QUIC versions are identified using a 32-bit unsigned number.
The version 0x00000000 is reserved to represent an invalid version.
This version of the specification is identified by the number
0x00000001.
Version 0x00000001 of QUIC uses TLS as a cryptographic handshake
protocol, as described in [QUIC-TLS].
Versions with the most significant 16 bits of the version number
cleared are reserved for use in future IETF consensus documents.
Versions that follow the pattern 0x?a?a?a?a are reserved for use in
forcing version negotiation to be exercised. That is, any version
number where the low four bits of all octets is 1010 (in binary). A
client or server MAY advertise support for any of these reserved
versions.
Iyengar & Thomson Expires April 16, 2018 [Page 8]
Internet-Draft QUIC Transport Protocol October 2017
Reserved version numbers will probably never represent a real
protocol; a client MAY use one of these version numbers with the
expectation that the server will initiate version negotiation; a
server MAY advertise support for one of these versions and can expect
that clients ignore the value.
[[RFC editor: please remove the remainder of this section before
publication.]]
The version number for the final version of this specification
(0x00000001), is reserved for the version of the protocol that is
published as an RFC.
Version numbers used to identify IETF drafts are created by adding
the draft number to 0xff000000. For example, draft-ietf-quic-
transport-13 would be identified as 0xff00000D.
Implementors are encouraged to register version numbers of QUIC that
they are using for private experimentation on the github wiki [4].
5. Packet Types and Formats
We first describe QUIC's packet types and their formats, since some
are referenced in subsequent mechanisms.
All numeric values are encoded in network byte order (that is, big-
endian) and all field sizes are in bits. When discussing individual
bits of fields, the least significant bit is referred to as bit 0.
Hexadecimal notation is used for describing the value of fields.
Any QUIC packet has either a long or a short header, as indicated by
the Header Form bit. Long headers are expected to be used early in
the connection before version negotiation and establishment of 1-RTT
keys. Short headers are minimal version-specific headers, which are
used after version negotiation and 1-RTT keys are established.
5.1. Long Header
Iyengar & Thomson Expires April 16, 2018 [Page 9]
Internet-Draft QUIC Transport Protocol October 2017
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
+-+-+-+-+-+-+-+-+
|1| Type (7) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ Connection ID (64) +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Packet Number (32) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version (32) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload (*) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 1: Long Header Format
Long headers are used for packets that are sent prior to the
completion of version negotiation and establishment of 1-RTT keys.
Once both conditions are met, a sender switches to sending packets
using the short header (Section 5.2). The long form allows for
special packets - such as the Version Negotiation packet - to be
represented in this uniform fixed-length packet format. A long
header contains the following fields:
Header Form: The most significant bit (0x80) of octet 0 (the first
octet) is set to 1 for long headers.
Long Packet Type: The remaining seven bits of octet 0 contain the
packet type. This field can indicate one of 128 packet types.
The types specified for this version are listed in Table 1.
Connection ID: Octets 1 through 8 contain the connection ID.
Section 5.6 describes the use of this field in more detail.
Packet Number: Octets 9 to 12 contain the packet number.
Section 5.7 describes the use of packet numbers.
Version: Octets 13 to 16 contain the selected protocol version.
This field indicates which version of QUIC is in use and
determines how the rest of the protocol fields are interpreted.
Payload: Octets from 17 onwards (the rest of QUIC packet) are the
payload of the packet.
The following packet types are defined:
Iyengar & Thomson Expires April 16, 2018 [Page 10]
Internet-Draft QUIC Transport Protocol October 2017
+------+------------------------+---------------+
| Type | Name | Section |
+------+------------------------+---------------+
| 0x01 | Version Negotiation |