You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/12/18 16:33:47 UTC
[trafficserver] branch quic-latest updated: Fix a bug that
receiving the first stream frame with fin flag causes RST_STREAM
This is an automated email from the ASF dual-hosted git repository.
maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 32225be Fix a bug that receiving the first stream frame with fin flag causes RST_STREAM
32225be is described below
commit 32225be3b3f084e91ac78141e36ace6986c8ba38
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Dec 19 01:31:43 2017 +0900
Fix a bug that receiving the first stream frame with fin flag causes RST_STREAM
This fixes #2951
---
iocore/net/quic/QUICIncomingFrameBuffer.cc | 7 ++-
.../net/quic/test/test_QUICIncomingFrameBuffer.cc | 61 +++++++++++++---------
2 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/iocore/net/quic/QUICIncomingFrameBuffer.cc b/iocore/net/quic/QUICIncomingFrameBuffer.cc
index 8975bc6..ba9cc51 100644
--- a/iocore/net/quic/QUICIncomingFrameBuffer.cc
+++ b/iocore/net/quic/QUICIncomingFrameBuffer.cc
@@ -119,14 +119,14 @@ QUICIncomingFrameBuffer::_check_and_set_fin_flag(QUICOffset offset, size_t len,
// FINAL_OFFSET_ERROR error, even after a stream is closed.
if (fin_flag) {
if (this->_fin_offset != UINT64_MAX) {
- if (this->_fin_offset == offset) {
+ if (this->_fin_offset == offset + len) {
// dup fin frame
return QUICErrorUPtr(new QUICNoError());
}
return QUICErrorUPtr(new QUICStreamError(this->_stream, QUICTransErrorCode::FINAL_OFFSET_ERROR));
}
- this->_fin_offset = offset;
+ this->_fin_offset = offset + len;
if (this->_max_offset >= this->_fin_offset) {
return QUICErrorUPtr(new QUICStreamError(this->_stream, QUICTransErrorCode::FINAL_OFFSET_ERROR));
@@ -135,8 +135,7 @@ QUICIncomingFrameBuffer::_check_and_set_fin_flag(QUICOffset offset, size_t len,
} else if (this->_fin_offset != UINT64_MAX && this->_fin_offset <= offset) {
return QUICErrorUPtr(new QUICStreamError(this->_stream, QUICTransErrorCode::FINAL_OFFSET_ERROR));
}
-
- this->_max_offset = std::max(offset, this->_max_offset);
+ this->_max_offset = std::max(offset + len, this->_max_offset);
return QUICErrorUPtr(new QUICNoError());
}
diff --git a/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc b/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
index a42369b..5652ba3 100644
--- a/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
+++ b/iocore/net/quic/test/test_QUICIncomingFrameBuffer.cc
@@ -35,31 +35,42 @@ TEST_CASE("QUICIncomingFrameBuffer_fin_offset", "[quic]")
uint8_t data[1024] = {0};
- std::shared_ptr<QUICStreamFrame> stream1_frame_0_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
- std::shared_ptr<QUICStreamFrame> stream1_frame_1_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 1024);
- std::shared_ptr<QUICStreamFrame> stream1_frame_2_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 2048, true);
- std::shared_ptr<QUICStreamFrame> stream1_frame_3_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 3072, true);
- std::shared_ptr<QUICStreamFrame> stream1_frame_4_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 4096);
-
- buffer.insert(stream1_frame_0_r);
- buffer.insert(stream1_frame_1_r);
- buffer.insert(stream1_frame_2_r);
- err = buffer.insert(stream1_frame_3_r);
- CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
-
- QUICIncomingFrameBuffer buffer2(stream);
-
- buffer2.insert(stream1_frame_3_r);
- buffer2.insert(stream1_frame_0_r);
- buffer2.insert(stream1_frame_1_r);
- err = buffer2.insert(stream1_frame_2_r);
- CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
-
- QUICIncomingFrameBuffer buffer3(stream);
-
- buffer3.insert(stream1_frame_4_r);
- err = buffer3.insert(stream1_frame_3_r);
- CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
+ SECTION("single frame")
+ {
+ std::shared_ptr<QUICStreamFrame> stream1_frame_0_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 0, true);
+
+ err = buffer.insert(stream1_frame_0_r);
+ CHECK(err->trans_error_code != QUICTransErrorCode::FINAL_OFFSET_ERROR);
+ }
+
+ SECTION("multiple frames")
+ {
+ std::shared_ptr<QUICStreamFrame> stream1_frame_0_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 0);
+ std::shared_ptr<QUICStreamFrame> stream1_frame_1_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 1024);
+ std::shared_ptr<QUICStreamFrame> stream1_frame_2_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 2048, true);
+ std::shared_ptr<QUICStreamFrame> stream1_frame_3_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 3072, true);
+ std::shared_ptr<QUICStreamFrame> stream1_frame_4_r = QUICFrameFactory::create_stream_frame(data, 1024, 1, 4096);
+
+ buffer.insert(stream1_frame_0_r);
+ buffer.insert(stream1_frame_1_r);
+ buffer.insert(stream1_frame_2_r);
+ err = buffer.insert(stream1_frame_3_r);
+ CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
+
+ QUICIncomingFrameBuffer buffer2(stream);
+
+ buffer2.insert(stream1_frame_3_r);
+ buffer2.insert(stream1_frame_0_r);
+ buffer2.insert(stream1_frame_1_r);
+ err = buffer2.insert(stream1_frame_2_r);
+ CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
+
+ QUICIncomingFrameBuffer buffer3(stream);
+
+ buffer3.insert(stream1_frame_4_r);
+ err = buffer3.insert(stream1_frame_3_r);
+ CHECK(err->trans_error_code == QUICTransErrorCode::FINAL_OFFSET_ERROR);
+ }
delete stream;
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].