Conversation
- Add DeterministicConnectionIdGenerator::set_expected_connection_id_length() and make expected_connection_id_length_ non-const; the bounds check moved into the setter and is shared with the constructor. - Remove the client connection ID overrides from MockableQuicClient (override_client_connection_id_, client_connection_id_overridden_, override_client_connection_id_length_, GetClientConnectionId(), UseClientConnectionIdLength(), UseClientConnectionId()); QuicTestClient now calls QuicClientBase::set_client_connection_id_length(). - Extract ConnectionMigrationNonZeroConnectionIDClientIPChange() from the existing end-to-end test, parameterize it by client connection ID length, and add a variant with kQuicMaxConnectionIdWithLengthPrefixLength. Issue google#62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MockableQuicClient::UseClientConnectionIdLength() updated override_client_connection_id_length_, which was used to create the initial CID in MockableQuicClient::GetClientConnectionId(), but it did not touch connection_id_generator_, which is constructed with expected_connection_id_length_ == kQuicDefaultConnectionIdLength.
Setting the initial CID also sets the framer's expected client CID length for whole connection in QuicConnection::set_client_connection_id.
As a result, the first CID had the length configured through MockableQuicClient::UseClientConnectionIdLength(), while every subsequent CID had DeterministicConnectionIdGenerator::expected_connection_id_length_, which is different to QuicFramer::expected_client_connection_id_length_.
Any packet carrying a CID of a different length than the one established by QuicConnection::set_client_connection_id is dropped rather than processed.
Solution
RFC 9000, Section 10.3.2 states that
An endpoint that uses this design MUST either use the same connection ID length for all connections or encode the length of the connection ID such that it can be recovered without state. In addition, it cannot provide a zero-length connection ID.In the current QUIC implementation, the CID length is set once in QuicClientBase::StartConnect and stays constant for the entire lifetime of the connection.
Since DeterministicConnectionIdGenerator has the same lifetime as QuicClientBase, expected_connection_id_length_ is no longer const and a setter for it was added. QuicClientBase::set_client_connection_id_length() now keeps the generator in sync.
The CID length must be changed before the first handshake to avoid CIDs of different lengths within one connection, so QuicClientBase::set_client_connection_id_length() carries a QUICHE_DCHECK(!connected()).
The following overrides were also removed from quic_test_client.h:
as this commit implements exactly that logic in QuicClientBase.
Testing
The multi-migration end-to-end test is now parameterized by the client connection ID length and additionally runs with kQuicMaxConnectionIdWithLengthPrefixLength, which fails without this fix.
Issue #62