Skip to content

Commit 3ea70b9

Browse files
committed
Some review-related changes and polish
1 parent c6c06e5 commit 3ea70b9

File tree

2 files changed

+68
-64
lines changed

2 files changed

+68
-64
lines changed

draft-ietf-quic-invariants.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ A QUIC packet with a long header has the high bit of the first octet set to 1.
153153
All other bits in that octet are version specific.
154154

155155
The next octet contains the length in octets of the two Connection IDs (see
156-
{{connection-id}}) that follow. Each length is encoded as a 4 bit unsigned
156+
{{connection-id}}) that follow. Each length is encoded as a 4-bit unsigned
157157
integer. The length of the Destination Connection ID (DCIL) occupies the high
158158
bits of the octet and the length of the Source Connection ID (SCIL) occupying
159159
the low bits of the octet. An encoded length of 0 indicates that the connection
@@ -163,12 +163,12 @@ or between 4 and 18 octets in length (inclusive). For example, an octet with
163163
the value 0xe0 describes a 17 octet Destination Connection ID and a zero octet
164164
Source Connection ID.
165165

166-
The connection ID lengths are followed by a two connection IDs. The connection
167-
ID associated with the recipient of the packet (the Destination Connection ID)
168-
is followed by the connection ID associated with the sender of the packet (the
169-
Source Connection ID).
166+
The connection ID lengths are followed by two connection IDs. The connection ID
167+
chosen by the recipient of the packet (the Destination Connection ID) is
168+
followed by the connection ID chosen by the sender of the packet (the Source
169+
Connection ID).
170170

171-
After both Connection IDs, a 32-bit Version (see {{version}}) is followed by a
171+
The Connection IDs are followed by a 32-bit Version (see {{version}}) and a
172172
version-specific payload.
173173

174174

@@ -192,9 +192,9 @@ version-specific semantics are marked with an X.
192192

193193
A QUIC packet with a short header has the high bit of the first octet set to 0.
194194

195-
A QUIC packet with a short header includes a Destination Connection ID. The
196-
short header does not include the Connection ID Lengths, Source Connection ID,
197-
or Version fields.
195+
A QUIC packet with a short header includes an optional Destination Connection
196+
ID. The short header does not include the Connection ID Lengths, Source
197+
Connection ID, or Version fields.
198198

199199
The remainder of the packet has version-specific semantics.
200200

@@ -272,12 +272,13 @@ Version Negotiation packets do not use integrity or confidentiality protection.
272272
A specific QUIC version might authenticate the packet as part of its connection
273273
establishment process.
274274

275-
The Connection ID fields in a Version Negotiation packet contain the Connection
276-
ID values from the packet that was received by the server, inverted to ensure
277-
correct routing of the packet toward the client based on the Destination
278-
Connection ID. Echoing the value of the client's Destination Connection ID in
279-
the Source Connection ID field can provide some protection against injection of
280-
Version Negotiation packets by off-path attackers.
275+
The server MUST include the value from the Source Connection ID field of the
276+
packet it receives in the Destination Connection ID field. The value for Source
277+
Connection ID MUST be copied from the Destination Connection ID of the received
278+
packet, which is initially randomly selected by a client. Echoing both
279+
connection IDs gives clients some assurance that the server received the packet
280+
and that the Version Negotiation packet was not generated by an off-path
281+
attacker.
281282

282283
An endpoint that receives a Version Negotiation packet might change the version
283284
that it decides to use for subsequent packets. The conditions under which an

draft-ietf-quic-transport.md

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ Connection:
163163

164164
Connection ID:
165165

166-
: An opaque identifier that is used to identify a QUIC connection. Each
167-
endpoint sets a value that its peer includes in packets.
166+
: An opaque identifier that is used to identify a QUIC connection at an
167+
endpoint. Each endpoint sets a value that its peer includes in packets.
168168

169169
QUIC packet:
170170

@@ -410,20 +410,20 @@ DCIL and SCIL:
410410
octet. An encoded length of 0 indicates that the connection ID is also 0
411411
octets in length. Non-zero encoded lengths are increased by 3 to get the full
412412
length of the connection ID, producing a length between 4 and 18 octets
413-
inclusive. For example, an octet with the value 0x50 describes an 8 octet
414-
Destination Connection ID and a zero octet Source Connection ID.
413+
inclusive. For example, an octet with the value 0x50 describes an 8-octet
414+
Destination Connection ID and a zero-length Source Connection ID.
415415

416416
Destination Connection ID:
417417

418-
: The Destination Connection ID field starts at octet 2 and is either 0 octets
419-
in length or between 4 and 18 octets. {{connection-id}} describes the use of
420-
this field in more detail.
418+
: The Destination Connection ID field follows the connection ID lengths and is
419+
either 0 octets in length or between 4 and 18 octets. {{connection-id}}
420+
describes the use of this field in more detail.
421421

422422
Source Connection ID:
423423

424-
: The Source Connection ID field starts at octet 2 and is either 0 octets in
425-
length or between 4 and 18 octets. {{connection-id}} describes the use of this
426-
field in more detail.
424+
: The Source Connection ID field follows the Destination Connection ID and is
425+
either 0 octets in length or between 4 and 18 octets. {{connection-id}}
426+
describes the use of this field in more detail.
427427

428428
Version:
429429

@@ -553,14 +553,6 @@ version-independent. The remaining fields are specific to the selected QUIC
553553
version. See {{QUIC-INVARIANTS}} for details on how packets from different
554554
versions of QUIC are interpreted.
555555

556-
The short header omits the Connection ID Lengths, Source Connection ID,
557-
and Version fields that appear in the long header. The length of the
558-
Destination Connecton ID field is expected to be known to endpoints. Endpoints
559-
with a load balancer that uses the connection ID can agree to a fixed or minimum
560-
length for connection IDs with necessary information in the fixed portion.
561-
If that fixed portion instead encodes an explicit length, the entire connection
562-
ID can vary in length and still be used by the load balancer.
563-
564556

565557
## Version Negotiation Packet {#packet-version}
566558

@@ -644,8 +636,14 @@ first cryptographic handshake message sent by the client.
644636

645637
If the client has not previously received a Retry packet from the server, it
646638
populates the Destination Connection ID field with a randomly selected value.
647-
This MUST be at least 8 octets in length. If the client received a Retry packet
648-
and is sending a second Initial packet, then it uses the value from the Source
639+
This MUST be at least 8 octets in length. Until a packet is received from the
640+
server, the client MUST use the same random value unless it also changes the
641+
Source Connection ID (which effectively starts a new connection attempt). The
642+
randomized Destination Connection ID is used to determine packet protection
643+
keys, but is not included in server packets.
644+
645+
If the client received a Retry packet and is sending a second Initial packet,
646+
then it sets the Destination Connection ID to the value from the Source
649647
Connection ID in the Retry packet.
650648

651649
The client populates the Source Connection ID field with a value of its choosing
@@ -779,32 +777,37 @@ Source Connection ID is used to set the Destination Connection ID used by a
779777
peer.
780778

781779
During the handshake, packets with the long header are used to establish the
782-
Destination Connection ID that each endpoint uses. Each endpoint uses the
783-
Source Connection ID field to specify the connection ID that is used in the
784-
Destination Connection ID field of packets being sent to them. Upon receiving a
785-
packet, each endpoint sets the Destination Connection ID it sends to match the
786-
value of the Source Connection ID that they receive.
780+
connection ID that each endpoint uses. Each endpoint uses the Source Connection
781+
ID field to specify the connection ID that is used in the Destination Connection
782+
ID field of packets being sent to them. Upon receiving a packet, each endpoint
783+
sets the Destination Connection ID it sends to match the value of the Source
784+
Connection ID that they receive.
787785

788786
During the handshake, an endpoint might receive multiple packets with the long
789787
header, and thus be given multiple opportunities to update the Destination
790788
Connection ID it sends. A client MUST only change the value it sends in the
791-
Destination Connection ID field in response to the first packet of each type
792-
(Retry, or Handshake) that it receives; a server MUST only change its value
793-
based on an Initial packet. This avoids problems that might arise from
794-
stateless processing of multiple Initial packets producing different connection
795-
IDs.
789+
Destination Connection ID in response to the first packet of each type (Retry,
790+
or Handshake) that it receives; a server MUST set its value based on the Initial
791+
packet. If subsequent packets of those types include a different Source
792+
Connection ID, they MUST be discarded. This avoids problems that might arise
793+
from stateless processing of multiple Initial packets producing different
794+
connection IDs.
796795

797796
Short headers only include the Destination Connection ID and omit the explicit
798-
length.
799-
800-
The very first packet sent by a client client includes a random value for
801-
Destination Connection ID. The same value MUST be used for all 0-RTT packets
802-
sent on that connection ({{packet-protected}}). This randomized value is used
803-
to determine the handshake packet protection keys (see Section 5.2.2 of
804-
{{QUIC-TLS}}).
797+
length. The length of the Destination Connecton ID field is expected to be
798+
known to endpoints. Endpoints with a load balancer that uses a connection ID
799+
can agree to a fixed or minimum length for connection IDs with necessary
800+
information in the fixed portion. If that fixed portion instead encodes an
801+
explicit length, the entire connection ID can vary in length and still be used
802+
by the load balancer.
803+
804+
The very first packet sent by a client includes a random value for Destination
805+
Connection ID. The same value MUST be used for all 0-RTT packets sent on that
806+
connection ({{packet-protected}}). This randomized value is used to determine
807+
the handshake packet protection keys (see Section 5.2.2 of {{QUIC-TLS}}).
805808

806809
A Version Negotiation ({{packet-version}}) packet MUST use both connection IDs
807-
selected by the client, inverted to ensure correct routing toward the client.
810+
selected by the client, swapped to ensure correct routing toward the client.
808811

809812

810813
## Packet Numbers {#packet-numbers}
@@ -1911,19 +1914,19 @@ This design ensures that a stateless reset packet is - to the extent possible -
19111914
indistinguishable from a regular packet.
19121915

19131916
A server generates a random 18-octet Destination Connection ID field. For a
1914-
client that requires that the server include a connection ID, this will mean
1915-
that this value differs from previous packets with two consequences:
1917+
client that depends on the server including a connection ID, this will mean that
1918+
this value differs from previous packets. Ths results in two problems:
19161919

19171920
* The packet might not reach the client. If the Destination Connection ID is
19181921
critical for routing toward the client, then this packet could be incorrectly
1919-
routed and dropped. This causes the stateless reset to be ineffective in
1920-
causing errors to be quickly detected and recovered. In this case, clients
1921-
will need to rely on other methods such as timers to detect that the
1922-
connection has failed.
1922+
routed. This causes the stateless reset to be ineffective in causing errors
1923+
to be quickly detected and recovered. In this case, clients will need to rely
1924+
on other methods - such as timers - to detect that the connection has failed.
19231925

1924-
* The connection ID can be used by entities other than the client to identify
1925-
this as a potential stateless reset. A server that occasionally uses
1926-
different connection IDs might introduce some uncertainty about this.
1926+
* The randomly generated connection ID can be used by entities other than the
1927+
client to identify this as a potential stateless reset. A server that
1928+
occasionally uses different connection IDs might introduce some uncertainty
1929+
about this.
19271930

19281931
The Packet Number field is set to a randomized value. The server SHOULD send a
19291932
packet with a short header and a type of 0x1F. This produces the shortest
@@ -2426,8 +2429,8 @@ Stateless Reset Token:
24262429

24272430
An endpoint MUST NOT send this frame if it currently requires that its peer send
24282431
packets with a zero-length Destination Connection ID. Changing the length of a
2429-
connection ID to or from zero-length makes it very difficult to identify when
2430-
the new connection ID was used. An endpoint that is sending packets with a a
2432+
connection ID to or from zero-length makes it difficult to identify when the
2433+
value of the connection ID changed. An endpoint that is sending packets with a
24312434
zero-length Destination Connection ID MUST treat receipt of a NEW_CONNECTION_ID
24322435
frame as a connection error of type PROTOCOL_VIOLATION.
24332436

0 commit comments

Comments
 (0)