1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00

Set upper limits on max_packet_size from the peer.

Summary: This will limit us to standard Ethernet MTU (1500) for now, but I think that is fine. This will allow us to experiment with packet size from the client more easily.

Reviewed By: yangchi

Differential Revision: D20709146

fbshipit-source-id: 608463de53d4520a257052491683263e14fc9682
This commit is contained in:
Matt Joras
2020-03-27 17:20:28 -07:00
committed by Facebook GitHub Bot
parent 19e1c14afd
commit 2176f080ff
5 changed files with 25 additions and 11 deletions

View File

@@ -181,7 +181,7 @@ class FakeServerHandshake : public ServerHandshake {
QuicServerConnectionState& conn_;
bool chloSync_{false};
bool cfinSync_{false};
uint64_t maxRecvPacketSize{2 * 1024};
uint64_t maxRecvPacketSize{kDefaultMaxUDPPayload};
bool allowZeroRttKeys_{false};
std::vector<folly::IPAddress> sourceAddrs_;
folly::Optional<uint64_t> clientActiveConnectionIdLimit_;
@@ -3645,6 +3645,7 @@ TEST_F(
server->getConn().transportSettings.limitedCwndInMss * originalUdpSize +
server->getConn().transportSettings.limitedCwndInMss *
server->getConn().udpSendPacketLen;
EXPECT_NE(originalUdpSize, server->getConn().udpSendPacketLen);
EXPECT_EQ(*server->getNonConstConn().writableBytesLimit, expectedLen);
std::vector<int> indices =
getQLogEventIndices(QLogEventType::TransportStateUpdate, qLogger);
@@ -3658,6 +3659,16 @@ TEST_F(
}
}
TEST_F(QuicUnencryptedServerTransportTest, MaxReceivePacketSizeTooLarge) {
getFakeHandshakeLayer()->allowZeroRttKeys();
auto originalUdpSize = server->getConn().udpSendPacketLen;
fakeHandshake->maxRecvPacketSize = 4096;
setupClientReadCodec();
recvClientHello();
EXPECT_NE(originalUdpSize, server->getConn().udpSendPacketLen);
EXPECT_EQ(server->getConn().udpSendPacketLen, kDefaultUDPSendPacketLen);
}
TEST_F(QuicUnencryptedServerTransportTest, TestGarbageData) {
auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server);
server->getNonConstConn().qLogger = qLogger;