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 1d1384a Fix QUICPacketLongHeader::size() and store()
1d1384a is described below
commit 1d1384a03a937274172a1d11794dffd099691ba4
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Thu Jun 21 15:58:01 2018 +0900
Fix QUICPacketLongHeader::size() and store()
---
iocore/net/quic/QUICPacket.cc | 4 ++--
iocore/net/quic/test/test_QUICPacket.cc | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 9ac10d5..bf738bb 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -176,7 +176,7 @@ QUICPacketLongHeader::QUICPacketLongHeader(QUICPacketType
type, QUICConnectionId
this->_buf_len =
LONG_HDR_OFFSET_CONNECTION_ID + this->_destination_cid.length() +
this->_source_cid.length() + this->_payload_length;
} else {
- // this->_buf_len will be updated when buf() is called
+ this->buf();
}
}
@@ -397,7 +397,7 @@ QUICPacketLongHeader::store(uint8_t *buf, size_t *len) const
pn_len = 4;
}
- QUICIntUtil::write_QUICVariableInt(QUICVariableInt::size(pn_len) +
this->_payload_length + aead_tag_len, buf + *len, &n);
+ QUICIntUtil::write_QUICVariableInt(pn_len + this->_payload_length +
aead_tag_len, buf + *len, &n);
*len += n;
QUICTypeUtil::write_QUICPacketNumber(pn, pn_len, buf + *len, &n);
diff --git a/iocore/net/quic/test/test_QUICPacket.cc
b/iocore/net/quic/test/test_QUICPacket.cc
index abf5366..e1be5de 100644
--- a/iocore/net/quic/test/test_QUICPacket.cc
+++ b/iocore/net/quic/test/test_QUICPacket.cc
@@ -79,7 +79,7 @@ TEST_CASE("QUICPacketHeader - Long", "[quic]")
SECTION("Long Header (store)")
{
- uint8_t buf[32] = {0};
+ uint8_t buf[64] = {0};
size_t len = 0;
const uint8_t expected[] = {
@@ -88,7 +88,7 @@ TEST_CASE("QUICPacketHeader - Long", "[quic]")
0x55, // DCIL/SCIL
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // Destination
Connection ID
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, // Source Connection ID
- 0x15, // Payload length (Not
0x05 because it will have 16 bytes of AEAD tag)
+ 0x19, // Length (Not 0x09
because it will have 16 bytes of AEAD tag)
0xC1, 0x23, 0x45, 0x67, // Packet number
0x11, 0x22, 0x33, 0x44, 0x55, // Payload (dummy)
};