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

Change default zero rtt matching policy

Summary:
This is a safer default than allowing limited on the source address not matching.

While here, also change the attemptEarlyData setting to false, since 0-rtt should be opt-in.

Reviewed By: yangchi, JunqiWang

Differential Revision: D21383402

fbshipit-source-id: b60fbbbe9438861eea894cb11ccb8bae2243a174
This commit is contained in:
Matt Joras
2020-05-04 14:42:46 -07:00
committed by Facebook GitHub Bot
parent 0c5f00f0dc
commit d83d7f3024
5 changed files with 21 additions and 2 deletions

View File

@@ -94,6 +94,7 @@ class ClientHandshakeTest : public Test, public boost::static_visitor<> {
cryptoState = conn->cryptoState.get(); cryptoState = conn->cryptoState.get();
handshake = conn->clientHandshakeLayer; handshake = conn->clientHandshakeLayer;
conn->transportSettings.attemptEarlyData = true;
std::vector<QuicVersion> supportedVersions = {getVersion()}; std::vector<QuicVersion> supportedVersions = {getVersion()};
auto serverTransportParameters = auto serverTransportParameters =
std::make_shared<ServerTransportParametersExtension>( std::make_shared<ServerTransportParametersExtension>(

View File

@@ -233,11 +233,18 @@ class QuicClientTransportIntegrationTest : public TestWithParam<TestingParams> {
std::make_shared<DefaultCongestionControllerFactory>()); std::make_shared<DefaultCongestionControllerFactory>());
client->setHostname(hostname); client->setHostname(hostname);
client->addNewPeerAddress(serverAddr); client->addNewPeerAddress(serverAddr);
auto transportSettings = client->getTransportSettings();
transportSettings.attemptEarlyData = true;
client->setTransportSettings(transportSettings);
return client; return client;
} }
std::shared_ptr<QuicServer> createServer(ProcessId processId) { std::shared_ptr<QuicServer> createServer(ProcessId processId) {
auto server = QuicServer::createQuicServer(); auto server = QuicServer::createQuicServer();
auto transportSettings = server->getTransportSettings();
transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
server->setTransportSettings(transportSettings);
server->setQuicServerTransportFactory( server->setQuicServerTransportFactory(
std::make_unique<EchoServerTransportFactory>()); std::make_unique<EchoServerTransportFactory>());
server->setQuicUDPSocketFactory( server->setQuicUDPSocketFactory(
@@ -5271,6 +5278,7 @@ class QuicZeroRttClientTest : public QuicClientTransportAfterStartTestBase {
TransportSettings clientSettings; TransportSettings clientSettings;
// Ignore path mtu to test negotiation. // Ignore path mtu to test negotiation.
clientSettings.canIgnorePathMTU = true; clientSettings.canIgnorePathMTU = true;
clientSettings.attemptEarlyData = true;
client->setTransportSettings(clientSettings); client->setTransportSettings(clientSettings);
} }

View File

@@ -28,6 +28,8 @@ TEST(DefaultAppTokenValidatorTest, TestValidParams) {
QuicServerConnectionState conn; QuicServerConnectionState conn;
conn.peerAddress = folly::SocketAddress("1.2.3.4", 443); conn.peerAddress = folly::SocketAddress("1.2.3.4", 443);
conn.version = QuicVersion::MVFST; conn.version = QuicVersion::MVFST;
conn.transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
AppToken appToken; AppToken appToken;
appToken.transportParams = createTicketTransportParameters( appToken.transportParams = createTicketTransportParameters(
@@ -54,6 +56,8 @@ TEST(
QuicServerConnectionState conn; QuicServerConnectionState conn;
conn.peerAddress = folly::SocketAddress("1.2.3.4", 443); conn.peerAddress = folly::SocketAddress("1.2.3.4", 443);
conn.version = QuicVersion::MVFST; conn.version = QuicVersion::MVFST;
conn.transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
auto initialMaxData = auto initialMaxData =
conn.transportSettings.advertisedInitialConnectionWindowSize; conn.transportSettings.advertisedInitialConnectionWindowSize;
@@ -291,6 +295,8 @@ class SourceAddressTokenTest : public Test {
void SetUp() override { void SetUp() override {
conn_.peerAddress = folly::SocketAddress("1.2.3.4", 443); conn_.peerAddress = folly::SocketAddress("1.2.3.4", 443);
conn_.version = QuicVersion::MVFST; conn_.version = QuicVersion::MVFST;
conn_.transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
appToken_.transportParams = createTicketTransportParameters( appToken_.transportParams = createTicketTransportParameters(
conn_.transportSettings.idleTimeout.count(), conn_.transportSettings.idleTimeout.count(),

View File

@@ -3614,6 +3614,8 @@ TEST_F(
TestClearInFlightBytesLimitationAfterCFIN) { TestClearInFlightBytesLimitationAfterCFIN) {
auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server); auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server);
server->getNonConstConn().qLogger = qLogger; server->getNonConstConn().qLogger = qLogger;
server->getNonConstConn().transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
getFakeHandshakeLayer()->allowZeroRttKeys(); getFakeHandshakeLayer()->allowZeroRttKeys();
auto originalUdpSize = server->getConn().udpSendPacketLen; auto originalUdpSize = server->getConn().udpSendPacketLen;
@@ -3670,6 +3672,8 @@ TEST_F(
auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server); auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server);
server->getNonConstConn().qLogger = qLogger; server->getNonConstConn().qLogger = qLogger;
getFakeHandshakeLayer()->allowZeroRttKeys(); getFakeHandshakeLayer()->allowZeroRttKeys();
server->getNonConstConn().transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
auto originalUdpSize = server->getConn().udpSendPacketLen; auto originalUdpSize = server->getConn().udpSendPacketLen;
setupClientReadCodec(); setupClientReadCodec();

View File

@@ -86,8 +86,8 @@ struct TransportSettings {
std::chrono::microseconds pacingTimerTickInterval{ std::chrono::microseconds pacingTimerTickInterval{
kDefaultPacingTimerTickInterval}; kDefaultPacingTimerTickInterval};
ZeroRttSourceTokenMatchingPolicy zeroRttSourceTokenMatchingPolicy{ ZeroRttSourceTokenMatchingPolicy zeroRttSourceTokenMatchingPolicy{
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH}; ZeroRttSourceTokenMatchingPolicy::REJECT_IF_NO_EXACT_MATCH};
bool attemptEarlyData{true}; bool attemptEarlyData{false};
// Maximum number of packets the connection will write in // Maximum number of packets the connection will write in
// writeConnectionDataToSocket. // writeConnectionDataToSocket.
uint64_t writeConnectionDataPacketsLimit{ uint64_t writeConnectionDataPacketsLimit{