RFC 9308
Applicability of the QUIC Transport Protocol
Applicability of the QUIC Transport Protocol ๐ฆ
Okay bestie, RFC 9308 is giving Informational energy, so it's not a Standards Track spec. It's a guidance doc for people building on top of QUIC โจ Mike Kรผhlewind (Ericsson) and Brian Trammell (Google Switzerland GmbH) wrote it, it's from the IETF, and it was published in September 2022 with ISSN 2070-1721 ๐ธ The header doesn't list any RFCs it obsoletes or updates, so it's a standalone moment ๐
Abstract
This document discusses the applicability of the QUIC transport protocol, focusing on caveats impacting application protocol development and deployment over QUIC. Its intended audience is designers of application protocol mappings to QUIC and implementors of these application protocols. ๐ง
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes. ๐
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are candidates for any level of Internet Standard; see Section 2 of RFC 7841. ๐
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc9308. โจ
Copyright Notice
Copyright (c) 2022 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 Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. ๐
Table of Contents ๐บ๏ธ
1. Introduction
2. The Necessity of Fallback
3. 0-RTT
3.1. Replay Attacks
3.2. Session Resumption versus Keep-Alive
4. Use of Streams
4.1. Stream versus Flow Multiplexing
4.2. Prioritization
4.3. Ordered and Reliable Delivery
4.4. Flow Control Deadlocks
4.5. Stream Limit Commitments
5. Packetization and Latency
6. Error Handling
7. Acknowledgment Efficiency
8. Port Selection and Application Endpoint Discovery
8.1. Source Port Selection
9. Connection Migration
10. Connection Termination
11. Information Exposure and the Connection ID
11.1. Server-Generated Connection ID
11.2. Mitigating Timing Linkability with Connection ID Migration
11.3. Using Server Retry for Redirection
12. Quality of Service (QoS) and Diffserv Code Point (DSCP)
13. Use of Versions and Cryptographic Handshake
14. Enabling Deployment of New Versions
15. Unreliable Datagram Service over QUIC
16. IANA Considerations
17. Security Considerations
18. References
18.1. Normative References
18.2. Informative References
Acknowledgments
Contributors
Authors' Addresses
1. Introduction โจ
QUIC [QUIC] is a brand new transport protocol with a bunch of advanced features ๐ It was originally designed for the HTTP use case, but it can do stuff that works with a much wider variety of applications. QUIC is encapsulated in UDP. QUIC version 1 integrates TLS 1.3 [TLS13] to encrypt all payload data and most control information. The version of HTTP that uses QUIC is known as HTTP/3 [QUIC-HTTP]. ๐ฆ
This document provides guidance for application developers who want to use the QUIC protocol without implementing it on their own. This includes general guidance for applications operating over HTTP/3 or directly over QUIC. ๐
In the following sections, we discuss specific caveats to QUIC's applicability and issues that application developers must consider when using QUIC as a transport for their applications. ๐ซถ
2. The Necessity of Fallback ๐
Okay so QUIC uses UDP as a substrate ๐ This is lowkey iconic because it enables userspace implementation and permits traversal of network middleboxes (including NAT) without requiring updates to existing network infrastructure.
Measurement studies have shown between 3% [Trammell16] and 5% [Swett16] of networks block all UDP traffic, though there is little evidence of other forms of systematic disadvantage to UDP traffic compared to TCP [Edeline16]. ๐ญ This blocking implies that all applications running on top of QUIC must either be prepared to accept connectivity failure on such networks or be engineered to fall back to some other transport protocol. In the case of HTTP, this fallback is TLS over TCP.
The IETF Transport Services (TAPS) specifications [TAPS-ARCH] describe a system with a common API for multiple protocols. This is particularly relevant for QUIC as it addresses the implications of fallback among multiple protocols. โจ
Specifically, fallback to insecure protocols or to weaker versions of secure protocols needs to be avoided. In general, an application that implements fallback needs to consider the security consequences. A fallback to TCP and TLS exposes control information to modification and manipulation in the network. Additionally, downgrades to TLS versions older than 1.3, which is used in QUIC version 1, might result in significantly weaker cryptographic protection. For example, the results of protocol negotiation [RFC7301] only have confidentiality protection if TLS 1.3 is used. ๐
These applications must operate, perhaps with impaired functionality, in the absence of features provided by QUIC not present in the fallback protocol. For fallback to TLS over TCP, the most obvious difference is that TCP does not provide stream multiplexing, and therefore stream multiplexing would need to be implemented in the application layer if needed. Further, TCP implementations and network paths often do not support the TCP Fast Open (TFO) option [RFC7413], which enables sending of payload data together with the first control packet of a new connection as also provided by 0-RTT session resumption in QUIC. Note that there is some evidence of middleboxes blocking SYN data even if TFO was successfully negotiated (see [PaaschNanog]). And even if Fast Open successfully operates end to end, it is limited to a single packet of TLS handshake and application data, unlike QUIC 0-RTT. ๐
Moreover, while encryption (in this case TLS) is inseparably integrated with QUIC, TLS negotiation over TCP can be blocked. If TLS over TCP cannot be supported, the connection should be aborted, and the application then ought to present a suitable prompt to the user that secure communication is unavailable. ๐จ
In summary, any fallback mechanism is likely to impose a degradation of performance and can degrade security; however, fallback must not silently violate the application's expectation of confidentiality or integrity of its payload data. ๐
3. 0-RTT ๐ง
QUIC provides for 0-RTT connection establishment. Though the same facility exists in TLS 1.3 with TCP, 0-RTT presents opportunities and challenges for applications using QUIC. โญ
A transport protocol that provides 0-RTT connection establishment is qualitatively different from one that does not provide 0-RTT from the point of view of the application using it. Relative trade-offs between the cost of closing and reopening a connection and trying to keep it open are different; see Section 3.2. ๐ฆ
An application needs to deliberately choose to use 0-RTT, as 0-RTT carries a risk of replay attack. Application protocols that use 0-RTT require a profile that describes the types of information that can be safely sent. For HTTP, this profile is described in [HTTP-REPLAY]. ๐
3.1. Replay Attacks ๐
Retransmission or malicious replay of data contained in 0-RTT packets could cause the server side to receive multiple copies of the same data. ๐
Application data sent by the client in 0-RTT packets could be processed more than once if it is replayed. Applications need to be aware of what is safe to send in 0-RTT. Application protocols that seek to enable the use of 0-RTT need a careful analysis and a description of what can be sent in 0-RTT; see Section 5.6 of [QUIC-TLS]. ๐ฅ
In some cases, it might be sufficient to limit application data sent in 0-RTT to data that does not cause actions with lasting effects at a server. Initiating data retrieval or establishing configuration are examples of actions that could be safe. Idempotent operations -- those for which repetition has the same net effect as a single operation -- might be safe. However, it is also possible to combine individually idempotent operations into a non-idempotent sequence of operations. ๐
Once a server accepts 0-RTT data, there is no means of selectively discarding data that is received. However, protocols can define ways to reject individual actions that might be unsafe if replayed. ๐ธ
Some TLS implementations and deployments might be able to provide partial or even complete replay protection, which could be used to manage replay risk. โจ
3.2. Session Resumption versus Keep-Alive
Okay so, because QUIC rides on top of UDP, apps using QUIC have to deal with really short network idle timeouts ๐ญ ๐ฆ Deployed stateful middleboxes will usually create state for a UDP flow on the very first packet and then keep it for way shorter idle periods than they would for TCP. [RFC5382] suggests a TCP idle period of at least 124 minutes, though there is no evidence of widespread implementation of this guideline in the literature. But short timeouts for UDP are super well-documented ๐ According to a 2010 study ([Hatonen10]), UDP applications can assume that any NAT binding or other state entry can expire after just thirty seconds of inactivity. Section 3.5 of [RFC8085] goes further into keep-alive intervals for UDP: it says there MUST be a minimum value of 15 seconds, but recommends larger values, or that keep-alive is omitted entirely.
Wait, I need to be precise here: the original actually says "requires," so the requirement is a MUST-level minimum in the source. Keep that force in mind as we go.
By using a connection ID, QUIC is designed to be robust to NAT rebinding after a timeout ๐ธ However, this only helps if one endpoint keeps availability at the address its peer uses, and the peer is the one that sends after the timeout occurs.
Some QUIC connections might not be robust to NAT rebinding, because the routing infrastructure (especially load balancers) uses the address/port 4-tuple to direct traffic ๐ง Also, middleboxes with functions other than address translation could still affect the path. Specifically, some firewalls do not admit server traffic for which the firewall has no recent state for a corresponding packet sent from the client. Major "why did my connection die" energy ๐
QUIC applications can adjust idle periods to manage the risk of timeout โจ Idle periods and the network idle timeout are different from the connection idle timeout, which is defined as the minimum of either endpoint's idle timeout parameter; see Section 10.1 of [QUIC]. There are three options:
- Ignore the issue if the application-layer protocol consists only of interactions with no or very short idle periods, or if the protocol's resistance to NAT rebinding is sufficient.
- Ensure there are no long idle periods.
- Resume the session after a long idle period, using 0-RTT resumption when appropriate.
The first strategy is the easiest, but it only applies to certain applications ๐
Either the server or the client in a QUIC application can send PING frames as keep-alives to prevent the connection and any on-path state from timing out ๐ Recommendations for keep-alives are application specific, mainly depending on the latency requirements and message frequency of the application. In this case, the application mapping must specify whether the client or server is responsible for keeping the application alive. While [Hatonen10] suggests that 30 seconds might be a suitable value for the public Internet when a NAT is on path, larger values are preferable if the deployment can consistently survive NAT rebinding, or is known to be in a controlled environment (e.g., data centers), in order to lower network and computational load ๐ซถ
Sending PING frames more frequently than every 30 seconds over long idle periods may result in excessive unproductive traffic in some situations, and unacceptable power usage for power-constrained (mobile) devices ๐ Additionally, timeouts shorter than 30 seconds can make it harder to handle transient network interruptions, such as Virtual Machine (VM) migration or coverage loss during mobility. See [RFC8085], especially Section 3.5.
Alternatively, the client (but not the server) can use session resumption instead of sending keep-alive traffic ๐ฆ In this case, a client that wants to send data to a server over a connection that has been idle longer than the server's idle timeout (available from the idle_timeout transport parameter) can simply reconnect. When possible, this reconnection can use 0-RTT session resumption, which reduces the latency involved with restarting the connection. Of course, this approach is only valid when it is safe to use 0-RTT and when the client is the restarting peer ๐
The trade-offs between resumption and keep-alives need to be evaluated on a per-application basis. In general, applications should use keep-alives only in circumstances where continued communication is highly likely; [QUIC-HTTP], for instance, recommends using keep-alives only when a request is outstanding ๐
4. Use of Streams ๐
Okay bestie, this is where it gets iconic ๐ QUIC's stream multiplexing feature lets applications run multiple streams over a single connection without head-of-line blocking between streams. Stream data is carried within frames, and one QUIC packet on the wire can carry one or multiple stream frames ๐
Streams can be unidirectional or bidirectional, and a stream may be initiated by either the client or the server. Only the initiator of a unidirectional stream can send data on it โจ
Streams and connections can each carry a maximum of 2^62-1 bytes in each direction, due to encoding limitations on stream offsets and connection flow control limits. In the presently unlikely event that an application actually hits this limit, a new connection would need to be established ๐ญ
Streams can be independently opened and closed, gracefully or abruptly. An application can gracefully close the egress direction of a stream by instructing QUIC to send a FIN bit in a STREAM frame. It cannot gracefully close the ingress direction without a peer-generated FIN, much like TCP. However, an endpoint can abruptly close the egress direction, or request that its peer abruptly close the ingress direction, and these actions are fully independent of each other ๐ฆ
QUIC does not provide an interface for exceptional handling of any stream. If a stream that is critical for an application is closed, the application can generate error messages at the application layer to inform the other end and/or the higher layer, which can eventually terminate the QUIC connection ๐ซ
Mapping of application data to streams is application specific, and it's described for HTTP/3 in [QUIC-HTTP]. There are a few general principles to apply when designing an application's use of streams ๐
- A single stream provides ordering. If the application requires certain data to be received in order, that data should be sent on the same stream. There is no guarantee of transmission, reception, or delivery order across streams.
- Multiple streams provide concurrency. Data that can be processed independently, and would therefore suffer from head-of-line blocking if forced to be received in order, should be transmitted over separate streams.
- Streams can provide message orientation and allow messages to be canceled. If one message is mapped to a single stream, resetting the stream to expire an unacknowledged message can be used to emulate partial reliability for that message ๐
If a QUIC receiver has opened the maximum allowed concurrent streams, and the sender indicates that more streams are needed, it does not automatically lead to an increase of the maximum number of streams by the receiver. Therefore, an application should consider the maximum number of allowed, currently open, and currently used streams when determining how to map data to streams ๐ง
QUIC assigns a numerical identifier, called the stream ID, to each stream. While the relationship between these identifiers and stream types is clearly defined in version 1 of QUIC, future versions might change this relationship for various reasons. QUIC implementations should expose the properties of each stream (which endpoint initiated the stream, whether the stream is unidirectional or bidirectional, and the stream ID used for the stream). Applications should query for these properties rather than attempting to infer them from the stream ID ๐ธ
The method of allocating stream identifiers to streams opened by the application might vary between transport implementations. Therefore, an application should not assume a particular stream ID will be assigned to a stream that has not yet been allocated. For example, HTTP/3 uses stream IDs to refer to streams that have already been opened, but makes no assumptions about future stream IDs or the way in which they are assigned (see Section 6 of [QUIC-HTTP]) ๐
4.1. Stream versus Flow Multiplexing ๐ฆ
Streams are meaningful only to the application. Since stream information is carried inside QUIC's encryption boundary, a given packet exposes no information about which stream(s) are carried within the packet. Therefore, stream multiplexing is not intended to be used for differentiating streams in terms of network treatment. Application traffic requiring different network treatment should therefore be carried over different 5-tuples (i.e., multiple QUIC connections). Given QUIC's ability to send application data in the first RTT of a connection (if a previous connection to the same host has been successfully established to provide the necessary credentials), the cost of establishing another connection is extremely low ๐
4.2. Prioritization ๐
Stream prioritization is not exposed to either the network or the receiver. Prioritization is managed by the sender, and the QUIC transport should provide an interface for applications to prioritize streams [QUIC]. Applications can implement their own prioritization scheme on top of QUIC: an application protocol that runs on top of QUIC can define explicit messages for signaling priority, such as those defined in [RFC9218] for HTTP. An application protocol can define rules that allow an endpoint to determine priority based on context, or it can provide a higher-level interface and leave the determination to the application on top ๐
Priority handling of retransmissions can be implemented by the sender in the transport layer. [QUIC] recommends retransmitting lost data before new data, unless indicated differently by the application. When a QUIC endpoint uses fully reliable streams for transmission, prioritization of retransmissions will be beneficial in most cases, filling in gaps and freeing up the flow control window. For partially reliable or unreliable streams, priority scheduling of retransmissions over data of higher-priority streams might not be desirable. For such streams, QUIC could either provide an explicit interface to control prioritization or derive the prioritization decision from the reliability level of the stream โจ
4.3. Ordered and Reliable Delivery ๐ซถ
QUIC streams enable ordered and reliable delivery. Though it is possible for an implementation to provide options that use streams for partial reliability or out-of-order delivery, most implementations will assume that data is reliably delivered in order.
Under this assumption, an endpoint that receives stream data might not make forward progress until data that is contiguous with the start of a stream is available. In particular, a receiver might withhold flow control credit until contiguous data is delivered to the application; see Section 2.2 of [QUIC]. To support this receive logic, an endpoint will send stream data until it is acknowledged, ensuring that data at the start of the stream is sent and acknowledged first ๐ฅ
An endpoint that uses a different sending behavior and does not negotiate that change with its peer might encounter performance issues or deadlocks ๐
4.4. Flow Control Deadlocks ๐
okay so bestie, QUIC flow control (Section 4 of [QUIC]) is basically the bouncer ๐ช for the limited buffers endpoints keep for incoming data. It caps how much data can be sitting in those buffers or floating around on the network. BUT ngl, those limits can also cause two annoying things: a connection that runs suboptimally, or one that gets totally deadlocked ๐
Deadlocks can happen with any protocol that runs on QUIC. Whether they actually become a problem depends on how implementations consume data and hand out flow control credit. Knowing what causes them is lowkey the best way to help implementations avoid them ๐ซถ
The size and rate of flow control credit updates can seriously affect performance โจ Apps using QUIC usually have a data consumer that reads from the transport buffers. Some implementations have separate receive buffers at the transport layer and the application layer. And consuming data doesn't always mean it's processed right away. The common move is to give the sender more credit by sending MAX_DATA and/or MAX_STREAM_DATA frames as data gets consumed. Those frames still have to travel the back channel from receiver to sender, so their latency matters. If credit doesn't show up in time, the sending app can get blocked, which basically throttles the sender ๐ข
Big application messages can deadlock if the recipient doesn't read data from the transport incrementally ๐ญ If a message is bigger than the flow control credit available, and the recipient won't release more credit until the whole message has been received and delivered, you get a deadlock. This can happen even when the stream flow control limits haven't been hit, because other streams can eat up the connection flow control limits.
A length-prefixed message format makes it easier for a data consumer to leave data unread in the transport buffer, which means it can withhold flow control credit ๐ If flow control limits stop the rest of a message from being sent, that's a deadlock. A length prefix might also help detect this kind of deadlock. And if an application protocol has messages that get processed as one unit, reserving flow control credit for the entire message atomically makes this style of deadlock less likely ๐
A data consumer can eagerly read all data as soon as it's available. That makes the receiver extend credit and lowers the chances of a deadlock. The catch is that such a consumer might need other ways to hold its peer accountable for the extra state it keeps for partially processed messages.
Deadlocks can also happen when data on different streams depends on other data ๐งฉ Say data on one stream arrives before the data on a second stream that it depends on. If the first stream is left unread, the receiver can't extend credit for the second stream, and boom, deadlock. To make this less likely, the sender should make sure dependent data isn't sent until the data it depends on has been counted in both stream-level and connection-level flow control credit.
Some deadlocking situations can be fixed by canceling the affected streams with STOP_SENDING or RESET_STREAM. Heads up though: in some protocols, canceling certain streams ends up terminating the whole connection ๐ฅฒ
4.5. Stream Limit Commitments ๐ฆ
okay so QUIC endpoints are responsible for telling their peer the cumulative limit of streams they're willing to let it open. The initial limits get advertised with the initial_max_streams_bidi and initial_max_streams_uni transport parameters. Every time a stream opens or closes, it gets used up, and the cumulative total goes up. Limits can be raised with the MAX_STREAMS frame, but there's no way to lower them ๐ โโ๏ธ Once the stream limits are hit, no more streams can be opened, and apps using QUIC can't make any further progress. At that point, connections can end via idle timeout or an explicit close; see Section 10.
Here's the drama: an app that communicates a cumulative stream limit might need the connection closed before the limit is reached. Like, say you want to stop the server for scheduled maintenance ๐ ๏ธ An immediate connection close causes abrupt closure of streams that are actively in use. Depending on how the app uses QUIC streams, that could be undesirable or even harmful to behavior or performance ๐ฌ
A more graceful way is to stop raising the stream limits and let the connection end naturally once the remaining streams are used up. The problem is that how long that takes depends on the peer, and an unpredictable closing period might not fit what the app or the operations team needs โณ Apps using QUIC can be conservative with their open stream limits to cut down on commitment and unpredictability. But being overly conservative hurts stream concurrency. Finding the balance is specific to each application and its deployment โ๏ธ
Instead of relying on stream limits to avoid abrupt closure, an application layer's graceful close mechanism can communicate the intent to explicitly close the connection at some point in the future ๐ธ HTTP/3 has exactly this, using the GOAWAY frame. In HTTP/3, when a client receives the GOAWAY frame, it stops opening new streams, even if the cumulative stream limit would still allow it. Instead, the client creates a new connection to open further streams on. Once all the streams on the old connection are closed, it can be terminated safely, either with a connection close or after the idle timeout expires (see Section 10). Iconic transition ๐
5. Packetization and Latency ๐ฆ
okay so QUIC gives the app a bunch of streams to work with, but the app usually can't control how its data gets mapped into frames or how those frames get bundled into packets ๐คทโโ๏ธ
By default, lots of implementations try to pack STREAM frames from one or more streams into each QUIC packet. That saves bandwidth and computational costs (see Section 13 of [QUIC]) ๐ง If there isn't enough data to fill a packet, an implementation might wait a short while to optimize bandwidth efficiency instead of latency. That delay can be preconfigured or adjusted dynamically based on the app's observed sending pattern โฑ๏ธ
If the app needs low latency and only has small chunks of data to send, it may be valuable to tell QUIC that all data should go out immediately ๐ Or, if the app expects to use a specific sending pattern, it can give QUIC a suggested delay for how long to wait before bundling frames into a packet.
The app usually has no control over the length of a QUIC packet on the wire either ๐ QUIC lets you add a PADDING frame to arbitrarily increase packet size. QUIC uses padding to make sure the path can carry datagrams of at least a certain size during the handshake (see Sections 8.1 and 14.1 of [QUIC]), for path validation after connection migration (see Section 8.2 of [QUIC]), and for Datagram Packetization Layer PMTU Discovery (DPLPMTUD) (see Section 14.3 of [QUIC]) ๐ง
Padding can also help an application reduce leakage of information about the data it sends ๐ A QUIC implementation can expose an interface that lets the application layer specify how padding should be applied.
6. Error Handling ๐จ
okay so QUIC recommends that endpoints signal any errors they detect to the peer ๐ Errors can happen at the transport layer and at the application layer. Transport errors, like a protocol violation, affect the entire connection. Apps that use QUIC can define their own error detection and signaling (see, for example, Section 8 of [QUIC-HTTP]). App errors can affect an entire connection or just a single stream ๐ฏ
QUIC defines an error code space for error handling at the transport layer. QUIC encourages endpoints to use the most specific code, but any applicable code is allowed, including generic ones ๐
Apps using QUIC define an error code space that's independent of QUIC or other apps (see, for example, Section 8.1 of [QUIC-HTTP]). The values in an application error code space can be reused across connection-level and stream-level errors ๐ฆ
Connection errors lead to connection termination. They're signaled with a CONNECTION_CLOSE frame, which holds an error code and a reason field that can be zero length ๐ Different types of CONNECTION_CLOSE frames are used to signal transport errors and application errors.
Stream errors lead to stream termination. These get signaled with STOP_SENDING or RESET_STREAM frames, which only contain an error code ๐
7. Acknowledgment Efficiency ๐ซง
okay so QUIC version 1 without extensions uses an acknowledgment strategy borrowed from TCP (see Section 13.2 of [QUIC]) ๐ฆ Basically, it recommends that every other packet gets acknowledged. But generating and processing QUIC acknowledgments eats up resources at both the sender and the receiver. Acks also have forwarding costs and add to link utilization, which can hurt performance over some types of network ๐ฅด Apps might be able to boost overall performance with alternative strategies that reduce how often acks get sent. [QUIC-ACK-FREQUENCY] describes an extension for signaling the desired delay of acknowledgments, and it covers use cases plus the implications for congestion control and recovery โจ
8. Port Selection and Application Endpoint Discovery ๐
Okay so, ports! ๐ฆ Port numbers have historically had two jobs. First, they tell apart different transport sessions between the same pair of endpoints. Second, they can also say which application protocol and service a process is connecting to (Section 3 of [RFC6335]). The "a port tells you the app" idea is way less true now, thanks to encapsulation and dynamic port assignments, as [RFC6335] also points out. Honestly, it's giving old-school vibes ๐ง
QUIC is a general-purpose transport, so there are no requirements that servers use any particular UDP port for it. ๐ For an application that falls back to TCP and doesn't already have a UDP mapping, it's usually appropriate to register (if needed) and use the UDP port number that matches the TCP port already registered for that app. For example, the default port for HTTP/3 [QUIC-HTTP] is UDP port 443, which is analogous to HTTP/1.1 or HTTP/2 over TLS over TCP. Iconic consistency ๐
Here's the thing though ๐ network management often assumes that a port number maps cleanly to one application. So using ports that can't easily be mapped to a registered service name might get you blocked, or get your traffic handled differently, by network elements like firewalls that rely on port numbers to identify applications. Not ideal!
Applications could define an alternate endpoint discovery mechanism so they can use ports other than the default. For instance, HTTP/3 (Sections 3.2 and 3.3 of [QUIC-HTTP]) uses HTTP Alternative Services [RFC7838] so an HTTP origin can advertise an equivalent HTTP/3 endpoint on a certain UDP port, using "h3" as the Application-Layer Protocol Negotiation (ALPN) [RFC7301] token. Main character discovery energy โจ
ALPN lets the client and server negotiate which of several protocols gets used on a given connection. So multiple applications might be supported on a single UDP port, depending on the ALPN token that's offered. ๐ซถ Applications using QUIC are required to register an ALPN token for use in the TLS handshake. Non-negotiable, bestie ๐
Now the version situation ๐ QUIC version 1 deferred defining a complete version negotiation mechanism. So HTTP/3 requires QUIC version 1, and it defines the ALPN token ("h3") to only apply to that version. Lowkey, nobody has picked one single approach for managing different QUIC versions yet, neither in HTTP/3 nor in general. Application protocols that use QUIC need to think about how they'll handle different QUIC versions. Choices made by other protocols, like HTTP/3, might help inform those decisions ๐
8.1. Source Port Selection
Some UDP protocols are vulnerable to reflection attacks ๐ญ That's where an attacker directs traffic at a third party as a denial of service. These source ports are linked to applications that are known to be vulnerable to reflection attacks, often because of server misconfiguration:
- port 53 - DNS [RFC1034]
- port 123 - NTP [RFC5905]
- port 1900 - SSDP [SSDP]
- port 5353 - mDNS [RFC6762]
- port 11211 - memcache
Services might block source ports tied to protocols that are known to be vulnerable to reflection attacks, just to avoid the overhead of processing huge numbers of packets. But this has negative effects on clients ๐ It doesn't just force a new connection. In some cases, the client might avoid QUIC for that service for a while and downgrade to a non-UDP protocol (see Section 2).
So client implementations are encouraged to avoid using source ports associated with protocols known to be vulnerable to reflection attacks. Following the general client guidance in [RFC6335] to use ephemeral ports in the range 49152-65535 has the effect of avoiding these ports, so that's a great shortcut โจ Note that other source ports might be reflection vectors as well, so stay alert, babe ๐
9. Connection Migration ๐ฆ
QUIC supports connection migration by the client. If the client's IP address changes, a QUIC endpoint can still link packets to an existing transport connection using the Destination Connection ID field (see Section 11) in the QUIC header. This works for cases where address information changes, like NAT rebinding, an intentional change of local interface, the expiration of a temporary IPv6 address [RFC8981], or the server indicating a preferred address (Section 9.6 of [QUIC]). Seamless, literally ๐ง
A non-zero-length connection ID for the server is strongly recommended if any clients are, or could be, behind a NAT. A non-zero-length connection ID is also strongly recommended when active migration is supported. If a connection is intentionally migrated to a new path, a new connection ID is used to minimize linkability by network observers. The other QUIC endpoint uses the connection ID to link different addresses to the same connection and entity, as long as a non-zero-length connection ID is provided. Privacy queen behavior ๐
The base specification of QUIC version 1 only supports one network path at a time, which enables failover use cases. Path validation is required so endpoints validate paths before using them, to avoid address spoofing attacks. Path validation takes at least one RTT, and congestion control also gets reset after path migration. So yeah, migration usually has a performance impact ๐ญ
QUIC probing packets can be sent on multiple paths at once. They're used to do address validation and to measure path characteristics. Probing packets can't carry application data, but they likely contain padding frames. Endpoints can use what they learn from receipt of these packets as input to congestion control for that path. Applications could also use what they learn from probing to decide whether to switch paths ๐ธ
Only the client can actively migrate in version 1 of QUIC. But servers can indicate during the handshake that they'd prefer to move the connection to a different address after the handshake. For instance, this could move a connection from an address shared by multiple servers to one that's unique to the server instance. The server can provide an IPv4 and an IPv6 address in a transport parameter during the TLS handshake, and the client can pick between the two if both are provided. See Section 9.6 of [QUIC]. โจ
10. Connection Termination ๐
QUIC connections end in one of three ways: an implicit idle timeout, an explicit immediate close, or an explicit stateless reset. ๐
QUIC does not provide any mechanism for graceful connection termination. Applications using QUIC can define their own graceful termination process (see, for example, Section 5.2 of [QUIC-HTTP]). Bring your own goodbye ๐ซถ
QUIC idle timeout is enabled via transport parameters. The client and server each announce a timeout period, and the effective value for the connection is the minimum of the two. Once the timeout period elapses, the connection is silently closed. So an application should be able to configure its own maximum value, and also have access to the computed minimum value for that connection. An application may adjust the maximum idle timeout for new connections based on how many connections are open or expected, since shorter timeout values may free up resources more quickly. Resource-saver era ๐
Application data exchanged on streams or in datagrams defers the QUIC idle timeout. So applications that provide their own keep-alive mechanisms will keep a QUIC connection alive. Applications that don't provide their own keep-alive can use transport-layer mechanisms (see Section 10.1.2 of [QUIC] and Section 3.2). However, QUIC implementation interfaces for controlling that transport behavior can vary, which affects how robust those approaches are ๐
An immediate close is signaled by a CONNECTION_CLOSE frame (see Section 6). An immediate close causes all streams to become immediately closed, which may affect applications; see Section 4.5. Dramatic exit, no notes ๐ฌ
A stateless reset is a last-resort option for an endpoint that doesn't have access to connection state. Receiving one is an indication of an unrecoverable error, and it's different from connection errors because it carries no application-layer information. Rough, but that's the vibe ๐
11. Information Exposure and the Connection ID ๐ฅ
QUIC exposes some information to the network in the unencrypted part of the header. This happens either before the encryption context is established, or because the information is meant to be used by the network. For more on manageability of QUIC, see [QUIC-MANAGEABILITY]. The long header exposes some extra information (the version and the source connection ID), while the short header exposes only the destination connection ID. In QUIC version 1, the long header is used during connection establishment, and the short header is used for data transmission in an established connection. Two headers, two vibes ๐ง
The connection ID can be zero length. Zero-length connection IDs can be chosen on each endpoint individually, and on any packet except the first packets sent by clients during connection establishment. ๐ฆ
An endpoint that selects a zero-length connection ID will receive packets with a zero-length destination connection ID. So the endpoint needs to use other information, like the source and destination IP address and port number, to figure out which connection is being referred to. This could mean the endpoint can't match datagrams to connections successfully if those values change. That would make the connection effectively unable to survive NAT rebinding or to migrate to a new path. Not the move ๐
11.1. Server-Generated Connection ID
QUIC supports a server-generated connection ID that's transmitted to the client during connection establishment (see Section 7.2 of [QUIC]). Servers behind load balancers may need to change the connection ID during the handshake, encoding the server's identity or information about its load balancing pool, so they can support stateless load balancing. Encoding that info is the whole trick โจ
Server deployments with load balancers and other routing infrastructure need to make sure that this infrastructure consistently routes packets to the server instance holding the connection state. That's true even if addresses, ports, or connection IDs change. This might require coordination between servers and infrastructure. One method of achieving this is encoding routing information into the connection ID. For an example of this technique, see [QUIC-LB]. Coordination is everything, periodt ๐๐
11.2. Mitigating Timing Linkability with Connection ID Migration ๐ฆ
okay so bestie, if QUIC endpoints don't issue fresh connection IDs, then clients can't reduce the linkability of address migration by using them ๐ . Picking values that look unlinkable to an outside observer is what keeps activity on different paths from being trivially correlated through the connection ID ๐ซถ.
ngl, sufficiently robust connection ID generation schemes will mitigate linkability issues, but they don't give full protection ๐ญ. Analyzing the lifetimes of 6-tuples (source and destination addresses as well as the migrated Connection ID) may expose these links anyway ๐.
If connection migration in a server pool is rare, it's trivial for an observer to associate two connection IDs ๐. Conversely, where every server handles multiple simultaneous migrations, even an exposed server mapping may not be enough information ๐.
The most efficient mitigations for these attacks come from network design and/or operational practices ๐:
- using a load-balancing architecture that loads more flows onto a single server-side address,
- coordinating the timing of migrations so there are more simultaneous migrations at a given time, or
- using other means.
11.3. Using Server Retry for Redirection ๐ง
QUIC provides a Retry packet that a server can send in response to the client Initial packet. The server may choose a new connection ID in that packet, and the client will retry by sending another client Initial packet with the server-selected connection ID. This mechanism can be used to redirect a connection to a different server, e.g., due to performance reasons or when servers in a server pool are upgraded gradually and therefore may support different versions of QUIC ๐.
It's assumed that all servers in a certain pool are served in cooperation with load balancers that forward traffic based on the connection ID. A server can choose the connection ID in the Retry packet so that the load balancer redirects the next Initial packet to a different server in that pool. Alternatively, the load balancer can directly offer a Retry offload, as further described in [QUIC-RETRY] โจ.
The approach described in Section 4 of [RFC5077] for constructing TLS resumption tickets is an example that can also be applied to validation tokens. However, the use of more modern cryptographic algorithms is highly recommended ๐.
12. Quality of Service (QoS) and Diffserv Code Point (DSCP) ๐
QUIC, as defined in [QUIC], has a single congestion controller and recovery handler. This design assumes that all packets of a QUIC connection, or at least those with the same 5-tuple {dest addr, source addr, protocol, dest port, source port}, that have the same Diffserv Code Point (DSCP) [RFC2475] will receive similar network treatment, since feedback about loss or delay of each packet is used as input to the congestion controller. Therefore, packets belonging to the same connection should use a single DSCP. Section 5.1 of [RFC7657] provides a discussion of Diffserv interactions with datagram transport protocols [RFC7657] (in this respect, the interactions with QUIC resemble those of Stream Control Transmission Protocol (SCTP)) ๐.
When multiplexing multiple flows over a single QUIC connection, the selected DSCP value should be the one associated with the highest priority requested for all multiplexed flows ๐ฅ.
If differential network treatment is desired, e.g., by using different DSCPs, multiple QUIC connections to the same server may be used. In general, it is recommended to minimize the number of QUIC connections to the same server, to avoid increased overhead and, more importantly, competing congestion control ๐ โโ๏ธ.
As in other uses of Diffserv, when a packet enters a network segment that doesn't support the DSCP value, this could result in the connection not receiving the network treatment it expects. The DSCP value in this packet could also be remarked as the packet travels along the network path, changing the requested treatment ๐ค.
13. Use of Versions and Cryptographic Handshake ๐
Versioning in QUIC may change the protocol's behavior completely, except for the meaning of a few header fields that have been declared to be invariant [QUIC-INVARIANTS]. A version of QUIC with a higher version number will not necessarily provide a better service, but might simply provide a different feature set. So an application needs to be able to select which versions of QUIC it wants to use ๐ .
A new version could use an encryption scheme other than TLS 1.3 or higher. [QUIC] specifies requirements for the cryptographic handshake as currently realized by TLS 1.3, which is described in a separate specification [QUIC-TLS]. This split is done to enable lightweight versioning with different cryptographic handshakes ๐ง.
The "QUIC Versions" registry established in [QUIC] allows for provisional registrations for experimentation. Registration, including of experimental versions, is important to avoid collisions. Experimental versions should not be used long-term or registered as permanent, to minimize the risk of fingerprinting based on the version number ๐ต๏ธโโ๏ธ.
14. Enabling Deployment of New Versions ๐
QUIC version 1 does not specify a version negotiation mechanism in the base specification, but [QUIC-VERSION-NEGOTIATION] proposes an extension that provides compatible version negotiation ๐ค.
This approach uses a three-stage deployment mechanism, enabling progressive rollout and experimentation with multiple versions across a large server deployment. In this approach, all servers in the deployment must accept connections using a new version (stage 1) before any server advertises it (stage 2). Authentication of the new version (stage 3) only proceeds after advertising of that version is completely deployed ๐ช.
See Section 5 of [QUIC-VERSION-NEGOTIATION] for details โจ.
15. Unreliable Datagram Service over QUIC ๐ฆ
[RFC9221] specifies a QUIC extension to enable sending and receiving unreliable datagrams over QUIC. Unlike operating directly over UDP, applications that use the QUIC datagram service don't need to implement their own congestion control, per [RFC8085], because QUIC datagrams are congestion controlled ๐.
QUIC datagrams are not flow controlled, so data chunks may be dropped if the receiver is overloaded ๐ฌ. The reliable transmission service of QUIC gives you a stream-based interface to send and receive data in order over multiple QUIC streams, but the datagram service has an unordered, message-based interface. If needed, application-layer framing can be used on top to allow separate flows of unreliable datagrams to be multiplexed on one QUIC connection ๐งฉ.
16. IANA Considerations ๐
This document has no actions for IANA. However, note that Section 8 recommends that an application that has already registered a TCP port, but wants to specify QUIC as a transport, should register a UDP port analogous to its existing TCP registration ๐.
17. Security Considerations โ ๏ธ
Okay, this section is serious, so pay attention ๐. See the security considerations in [QUIC] and [QUIC-TLS]. The security considerations for the underlying transport protocol are relevant for applications using QUIC. Considerations on linkability, replay attacks, and randomness discussed in [QUIC-TLS] should be taken into account when deploying and using QUIC ๐.
Further, migration to a new address exposes a linkage between client addresses to the server. It may also expose this linkage to the path, if the connection ID cannot be changed or flows can otherwise be correlated. When migration is supported, this needs to be considered with respective to user privacy ๐ซฃ.
Application developers: any fallback you use when QUIC can't be used because of network blocking of UDP should guarantee the same security properties as QUIC. If that's not possible, the connection should fail, so the application can explicitly handle fallback to a less-secure alternative. See Section 2 ๐.
Further, [QUIC-HTTP] provides security considerations specific to HTTP. However, discussions such as those on cross-protocol attacks, traffic analysis and padding, or migration might be relevant for other applications using QUIC as well ๐ธ.
18. References ๐
18.1. Normative References
[QUIC] Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based
Multiplexed and Secure Transport", RFC 9000,
DOI 10.17487/RFC9000, May 2021,
<https://www.rfc-editor.org/info/rfc9000>.
[QUIC-INVARIANTS]
Thomson, M., "Version-Independent Properties of QUIC",
RFC 8999, DOI 10.17487/RFC8999, May 2021,
<https://www.rfc-editor.org/info/rfc8999>.
[QUIC-TLS] Thomson, M., Ed. and S. Turner, Ed., "Using TLS to Secure
QUIC", RFC 9001, DOI 10.17487/RFC9001, May 2021,
<https://www.rfc-editor.org/info/rfc9001>.
18.2. Informative References โจ
These are the extra reads, bestie ๐. They're not required to implement the thing, but they're the receipts behind the ideas. ๐
[Edeline16] Edeline, K., Kรผhlewind, M., Trammell, B., Aben, E., and B. Donnet, "Using UDP for Internet Transport Evolution", DOI 10.48550/arXiv.1612.07816, 22 December 2016, https://arxiv.org/abs/1612.07816. ๐ฆ
[Hatonen10] Hรคtรถnen, S., Nyrhinen, A., Eggert, L., Strowes, S., Sarolahti, P., and M. Kojo, "An Experimental Study of Home Gateway Characteristics", Proc. ACM IMC 2010, November 2010, https://conferences.sigcomm.org/imc/2010/papers/p260.pdf. ๐
[HTTP-REPLAY] Thomson, M., Nottingham, M., and W. Tarreau, "Using Early Data in HTTP", RFC 8470, DOI 10.17487/RFC8470, September 2018, https://www.rfc-editor.org/info/rfc8470. ๐ธ
[PaaschNanog] Paasch, C., "Network support for TCP Fast Open", NANOG 67 Presentation, 13 June 2016, https://www.nanog.org/sites/default/files/Paasch_Network_Support.pdf. ๐
[QUIC-ACK-FREQUENCY] Iyengar, J. and I. Swett, "QUIC Acknowledgement Frequency", Work in Progress, Internet-Draft, draft-ietf-quic-ack-frequency-02, 11 July 2022, https://datatracker.ietf.org/doc/html/draft-ietf-quic-ack-frequency-02. ๐ง
[QUIC-HTTP] Bishop, M., Ed., "HTTP/3", RFC 9114, DOI 10.17487/RFC9114, June 2022, https://www.rfc-editor.org/info/rfc9114. ๐
[QUIC-LB] Duke, M., Banks, N., and C. Huitema, "QUIC-LB: Generating Routable QUIC Connection IDs", Work in Progress, Internet-Draft, draft-ietf-quic-load-balancers-14, 11 July 2022, https://datatracker.ietf.org/doc/html/draft-ietf-quic-load-balancers-14. โ๏ธ
[QUIC-MANAGEABILITY] Kรผhlewind, M. and B. Trammell, "Manageability of the QUIC Transport Protocol", RFC 9312, DOI 10.17487/RFC9312, September 2022, https://www.rfc-editor.org/info/rfc9312. ๐ง
[QUIC-RETRY] Duke, M. and N. Banks, "QUIC Retry Offload", Work in Progress, Internet-Draft, draft-ietf-quic-retry-offload-00, 25 May 2022, https://datatracker.ietf.org/doc/html/draft-ietf-quic-retry-offload-00. ๐
[QUIC-VERSION-NEGOTIATION] Schinazi, D. and E. Rescorla, "Compatible Version Negotiation for QUIC", Work in Progress, Internet-Draft, draft-ietf-quic-version-negotiation-10, 27 September 2022, https://datatracker.ietf.org/doc/html/draft-ietf-quic-version-negotiation-10. ๐ค
[RFC1034] Mockapetris, P., "Domain names - concepts and facilities", STD 13, RFC 1034, DOI 10.17487/RFC1034, November 1987, https://www.rfc-editor.org/info/rfc1034. ๐
[RFC2475] Blake, S., Black, D., Carlson, M., Davies, E., Wang, Z., and W. Weiss, "An Architecture for Differentiated Services", RFC 2475, DOI 10.17487/RFC2475, December 1998, https://www.rfc-editor.org/info/rfc2475. ๐ท๏ธ
[RFC5077] Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig, "Transport Layer Security (TLS) Session Resumption without Server-Side State", RFC 5077, DOI 10.17487/RFC5077, January 2008, https://www.rfc-editor.org/info/rfc5077. ๐
[RFC5382] Guha, S., Ed., Biswas, K., Ford, B., Sivakumar, S., and P. Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, RFC 5382, DOI 10.17487/RFC5382, October 2008, https://www.rfc-editor.org/info/rfc5382. ๐งญ
[RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, "Network Time Protocol Version 4: Protocol and Algorithms Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, https://www.rfc-editor.org/info/rfc5905. โฐ
[RFC6335] Cotton, M., Eggert, L., Touch, J., Westerlund, M., and S. Cheshire, "Internet Assigned Numbers Authority (IANA) Procedures for the Management of the Service Name and Transport Protocol Port Number Registry", BCP 165, RFC 6335, DOI 10.17487/RFC6335, August 2011, https://www.rfc-editor.org/info/rfc6335. ๐๏ธ
[RFC6762] Cheshire, S. and M. Krochmal, "Multicast DNS", RFC 6762, DOI 10.17487/RFC6762, February 2013, https://www.rfc-editor.org/info/rfc6762. ๐ก
[RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, July 2014, https://www.rfc-editor.org/info/rfc7301. ๐ฃ๏ธ
[RFC7413] Cheng, Y., Chu, J., Radhakrishnan, S., and A. Jain, "TCP Fast Open", RFC 7413, DOI 10.17487/RFC7413, December 2014, https://www.rfc-editor.org/info/rfc7413. โก
[RFC7657] Black, D., Ed. and P. Jones, "Differentiated Services (Diffserv) and Real-Time Communication", RFC 7657, DOI 10.17487/RFC7657, November 2015, https://www.rfc-editor.org/info/rfc7657. ๐
[RFC7838] Nottingham, M., McManus, P., and J. Reschke, "HTTP Alternative Services", RFC 7838, DOI 10.17487/RFC7838, April 2016, https://www.rfc-editor.org/info/rfc7838. ๐
[RFC8085] Eggert, L., Fairhurst, G., and G. Shepherd, "UDP Usage Guidelines", BCP 145, RFC 8085, DOI 10.17487/RFC8085, March 2017, https://www.rfc-editor.org/info/rfc8085. ๐ฎ
[RFC8981] Gont, F., Krishnan, S., Narten, T., and R. Draves, "Temporary Address Extensions for Stateless Address Autoconfiguration in IPv6", RFC 8981, DOI 10.17487/RFC8981, February 2021, https://www.rfc-editor.org/info/rfc8981. ๐ซฅ
[RFC9218] Oku, K. and L. Pardue, "Extensible Prioritization Scheme for HTTP", RFC 9218, DOI 10.17487/RFC9218, June 2022, https://www.rfc-editor.org/info/rfc9218. ๐ฅ
[RFC9221] Pauly, T., Kinnear, E., and D. Schinazi, "An Unreliable Datagram Extension to QUIC", RFC 9221, DOI 10.17487/RFC9221, March 2022, https://www.rfc-editor.org/info/rfc9221. ๐
[SSDP] Donoho, A., Roe, B., Bodlaender, M., Gildred, J., Messer, A., Kim, Y., Fairman, B., and J. Tourzan, "UPnP Device Architecture 2.0", 17 April 2020, https://openconnectivity.org/upnp-specs/UPnP-arch-DeviceArchitecture-v2.0-20200417.pdf. ๐จ๏ธ
[Swett16] Swett, I., "QUIC Deployment Experience @Google", IETF96 QUIC BoF Presentation, 20 July 2016, https://www.ietf.org/proceedings/96/slides/slides-96-quic-3.pdf. ๐ค
[TAPS-ARCH] Pauly, T., Trammell, B., Brunstrom, A., Fairhurst, G., and C. Perkins, "An Architecture for Transport Services", Work in Progress, Internet-Draft, draft-ietf-taps-arch-14, 27 September 2022, https://datatracker.ietf.org/doc/html/draft-ietf-taps-arch-14. ๐๏ธ
[TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, https://www.rfc-editor.org/info/rfc8446. ๐
[Trammell16] Trammell, B. and M. Kรผhlewind, "Internet Path Transparency Measurements using RIPE Atlas", RIPE 72 MAT Presentation, 25 May 2016, https://ripe72.ripe.net/wp-content/uploads/presentations/86-atlas-udpdiff.pdf. ๐ฐ๏ธ
Acknowledgments ๐ซถ
Special thanks to Last Call reviewers Chris Lonvick and Ines Robles. ๐
This work was 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. ๐ช๐บ๐จ๐ญ
Contributors ๐
The following people have contributed significant text to or feedback on this document: ๐
- Gorry Fairhurst ๐
- Ian Swett ๐ธ
- Igor Lubashev ๐ฆ
- Lucas Pardue ๐
- Mike Bishop ๐ง
- Mark Nottingham โญ
- Martin Duke ๐ฅ
- Martin Thomson ๐
- Sean Turner ๐
- Tommy Pauly ๐ซถ
Authors' Addresses ๐
Mirja Kรผhlewind
Ericsson
Email: mirja.kuehlewind@ericsson.com
Brian Trammell
Google Switzerland GmbH
Gustav-Gull-Platz 1
CH-8004 Zurich
Switzerland
Email: ietf@trammell.ch
๐ฆ where this page comes from
- ietf: rfc9308 2022-09
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms