1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-09 20:42:44 +03:00

Add some sanity checks around cipher dropping.

Summary: As in title, these shouldn't happen.

Reviewed By: oesh, yangchi

Differential Revision: D22138561

fbshipit-source-id: cb51f3e795a1784e3f2ece675a95ac18a4be2701
This commit is contained in:
Matt Joras
2020-06-22 09:09:02 -07:00
committed by Facebook GitHub Bot
parent 64f384a6af
commit 70f40cc1c2
4 changed files with 14 additions and 6 deletions

View File

@@ -1434,8 +1434,11 @@ void implicitAckCryptoStream(
}
}
},
// Can't do anything with loss at this point.
[](auto&, auto&, auto, auto) {},
// We shouldn't mark anything as lost from the implicit ACK, as it should
// be ACKing the entire rangee.
[](auto&, auto&, auto, auto) {
LOG(FATAL) << "Got loss from implicit crypto ACK.";
},
implicitAckTime);
// Clear our the loss buffer explicity. The implicit ACK itself will not
// remove data already in the loss buffer.
@@ -1447,7 +1450,12 @@ void implicitAckCryptoStream(
}
void handshakeConfirmed(QuicConnectionStateBase& conn) {
// If we've supposedly confirmed the handshake and don't have the 1RTT
// ciphers installed, we are going to have problems.
CHECK(conn.oneRttWriteCipher);
CHECK(conn.oneRttWriteHeaderCipher);
CHECK(conn.readCodec->getOneRttReadCipher());
CHECK(conn.readCodec->getOneRttHeaderCipher());
conn.readCodec->onHandshakeDone(Clock::now());
conn.initialWriteCipher.reset();
conn.initialHeaderCipher.reset();

View File

@@ -2170,6 +2170,9 @@ TEST_F(QuicTransportFunctionsTest, HandshakeConfirmedDropCipher) {
conn->readCodec->setHandshakeReadCipher(createNoOpAead());
conn->readCodec->setHandshakeHeaderCipher(createNoOpHeaderCipher());
conn->oneRttWriteCipher = createNoOpAead();
conn->oneRttWriteHeaderCipher = createNoOpHeaderCipher();
conn->readCodec->setOneRttReadCipher(createNoOpAead());
conn->readCodec->setOneRttHeaderCipher(createNoOpHeaderCipher());
writeCryptoDataProbesToSocketForTest(
*socket,
*conn,

View File

@@ -290,10 +290,6 @@ void QuicClientTransport::processPacketData(
// drop the handshake cipher and outstanding packets after the
// processing loop.
if (conn_->handshakeWriteCipher) {
CHECK(conn_->oneRttWriteCipher);
CHECK(conn_->oneRttWriteHeaderCipher);
CHECK(conn_->readCodec->getOneRttReadCipher());
CHECK(conn_->readCodec->getOneRttHeaderCipher());
conn_->handshakeLayer->handshakeConfirmed();
}
// TODO reap

View File

@@ -480,6 +480,7 @@ size_t writeSimpleFrame(
case QuicSimpleFrame::Type::HandshakeDoneFrame_E: {
const HandshakeDoneFrame& handshakeDoneFrame =
*frame.asHandshakeDoneFrame();
CHECK(builder.getPacketHeader().asShort());
QuicInteger intFrameType(static_cast<uint8_t>(FrameType::HANDSHAKE_DONE));
if (packetSpaceCheck(spaceLeft, intFrameType.getSize())) {
builder.write(intFrameType);