1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

Fix the default active connection id limit when the peer doesn't send the transport parameter

Summary:
When the client doesn't send the active_connection_id_limit transport parameter, the server was wrongly defaulting to 5 instead of 2.
(https://datatracker.ietf.org/doc/html/rfc9000#section-18.2-6.2.1)

This was uncovered by https://github.com/curl/curl/issues/14043.

In that case, ngtcp2 does not send the transport parameter when its value is set to 2.

Reviewed By: hanidamlaj, meleshuk

Differential Revision: D59165736

fbshipit-source-id: e44507550b2d0eb4c97f1f7f9879bfdca4746526
This commit is contained in:
Joseph Beshay
2024-06-28 16:45:26 -07:00
committed by Facebook GitHub Bot
parent 1c1f91a95c
commit 625b7e252a
3 changed files with 37 additions and 3 deletions

View File

@@ -249,7 +249,7 @@ TEST(ServerStateMachineTest, TestProcessMinAckDelayNotSet) {
ClientTransportParameters clientTransportParams = {
std::move(transportParams)};
processClientInitialParams(serverConn, clientTransportParams);
EXPECT_FALSE(serverConn.peerAdvertisedKnobFrameSupport);
EXPECT_FALSE(serverConn.peerMinAckDelay.has_value());
}
TEST(ServerStateMachineTest, TestProcessMinAckDelaySet) {
@@ -336,6 +336,35 @@ TEST(ServerStateMachineTest, TestEncodeKnobFrameSupportedParamDisabled) {
testing::Eq(TransportParameterId::knob_frames_supported)))));
}
TEST(ServerStateMachineTest, TestProcessActiveConnectionIdLimitNotSet) {
QuicServerConnectionState serverConn(
FizzServerQuicHandshakeContext::Builder().build());
std::vector<TransportParameter> transportParams;
ClientTransportParameters clientTransportParams = {
std::move(transportParams)};
processClientInitialParams(serverConn, clientTransportParams);
// Check that the value is the default specified in RFC9000 when the transport
// parameter is absent
// https://datatracker.ietf.org/doc/html/rfc9000#section-18.2-6.2.1
EXPECT_EQ(serverConn.peerActiveConnectionIdLimit, 2);
}
TEST(ServerStateMachineTest, TestProcessActiveConnectionIdLimitSet) {
QuicServerConnectionState serverConn(
FizzServerQuicHandshakeContext::Builder().build());
std::vector<TransportParameter> transportParams;
transportParams.push_back(encodeIntegerParameter(
TransportParameterId::active_connection_id_limit,
kMaxActiveConnectionIdLimit + 1));
ClientTransportParameters clientTransportParams = {
std::move(transportParams)};
processClientInitialParams(serverConn, clientTransportParams);
// This tests for max + 1. The maximum value will be enforced on sending the
// new connection id frames, not in parsing the parameters.
EXPECT_EQ(
serverConn.peerActiveConnectionIdLimit, kMaxActiveConnectionIdLimit + 1);
}
struct advertisedMaxStreamGroupstestStruct {
uint64_t peerMaxGroupsIn;
OptionalIntegral<uint64_t> expectedTransportSettingVal;