Skip to content

Commit

Permalink
Randomize packet numbers more, not less (#964)
Browse files Browse the repository at this point in the history
* Randomize packet numbers more, not less

Closes #864, #850.

* More precisely define the range (not that it matters)

* Remove sentence about encodings
  • Loading branch information
martinthomson authored and janaiyengar committed Nov 30, 2017
1 parent 881b787 commit 973c6dd
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions draft-ietf-quic-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,14 +743,22 @@ have special rules for populating the packet number field.

### Initial Packet Number {#initial-packet-number}

The initial value for packet number MUST be selected from an uniform random
distribution between 0 and 2^31-1. That is, the lower 31 bits of the packet
number are randomized. {{?RFC4086}} provides guidance on the generation of
random values.

The first set of packets sent by an endpoint MUST include the low 32-bits of the
packet number. Once any packet has been acknowledged, subsequent packets can
use a shorter packet number encoding.
The initial value for packet number MUST be selected randomly from a range
between 0 and 2^32 - 1025 (inclusive). This value is selected so that Initial
and Handshake packets exercise as many possible values for the Packet Number
field as possible.

Limiting the range allows both for loss of packets and for any stateless
exchanges. Packet numbers are incremented for subsequent packets, but packet
loss and stateless handling can both mean that the first packet sent by an
endpoint isn't necessarily the first packet received by its peer. The first
packet received by a peer cannot be 2^32 or greater or the recipient will
incorrectly assume a packet number that is 2^32 values lower and discard the
packet.

Use of a secure random number generator {{?RFC4086}} is not necessary for
generating the initial packet number, nor is it necessary that the value be
uniformly distributed.


## Handling Packets from Different Versions {#version-specific}
Expand Down

0 comments on commit 973c6dd

Please sign in to comment.