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 32b5f3d Fix a check for connection id presence 32b5f3d is described below commit 32b5f3d1254a8d0989113a5290c634ec0408385d Author: Masakazu Kitajo <mas...@apache.org> AuthorDate: Thu Dec 14 16:16:38 2017 +0900 Fix a check for connection id presence --- iocore/net/QUICPacketHandler.cc | 10 +++++----- iocore/net/quic/QUICPacket.cc | 4 ++-- iocore/net/quic/QUICTypes.cc | 8 +++++++- iocore/net/quic/QUICTypes.h | 3 ++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc index 5c5583f..97ad727 100644 --- a/iocore/net/QUICPacketHandler.cc +++ b/iocore/net/QUICPacketHandler.cc @@ -97,13 +97,13 @@ QUICPacketHandler::_read_connection_id(QUICConnectionId &cid, IOBufferBlock *blo const uint8_t cid_offset = 1; const uint8_t cid_len = 8; - if (QUICTypeUtil::hasLongHeader(buf)) { + if (QUICTypeUtil::has_long_header(buf)) { cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len); } else { - if (buf[0] & 0x40) { - cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len); - } else { + if (QUICTypeUtil::has_connection_id(buf)) { return false; + } else { + cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len); } } @@ -135,7 +135,7 @@ QUICPacketHandler::_recv_packet(int event, UDPPacket *udpPacket) con.setRemote(&udpPacket->from.sa); // Send stateless reset if the packet is not a initial packet - if (!QUICTypeUtil::hasLongHeader(reinterpret_cast<const uint8_t *>(block->buf()))) { + if (!QUICTypeUtil::has_long_header(reinterpret_cast<const uint8_t *>(block->buf()))) { QUICStatelessResetToken token; { QUICConfig::scoped_config params; diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc index 01802ba..2473f04 100644 --- a/iocore/net/quic/QUICPacket.cc +++ b/iocore/net/quic/QUICPacket.cc @@ -64,7 +64,7 @@ QUICPacketHeader::packet_size() const QUICPacketHeader * QUICPacketHeader::load(const uint8_t *buf, size_t len, QUICPacketNumber base) { - if (QUICTypeUtil::hasLongHeader(buf)) { + if (QUICTypeUtil::has_long_header(buf)) { QUICPacketLongHeader *long_header = quicPacketLongHeaderAllocator.alloc(); new (long_header) QUICPacketLongHeader(buf, len, base); return long_header; @@ -387,7 +387,7 @@ bool QUICPacketShortHeader::has_connection_id() const { if (this->_buf) { - return (this->_buf[0] & 0x40) == 0; + return QUICTypeUtil::has_connection_id(this->_buf); } else { return this->_has_connection_id; } diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc index 89d5eca..045b2c9 100644 --- a/iocore/net/quic/QUICTypes.cc +++ b/iocore/net/quic/QUICTypes.cc @@ -30,11 +30,17 @@ ats_unique_malloc(size_t size) } bool -QUICTypeUtil::hasLongHeader(const uint8_t *buf) +QUICTypeUtil::has_long_header(const uint8_t *buf) { return (buf[0] & 0x80) != 0; } +bool +QUICTypeUtil::has_connection_id(const uint8_t *buf) +{ + return (buf[0] & 0x40) == 0; +} + QUICStreamType QUICTypeUtil::detect_stream_type(QUICStreamId id) { diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h index 030487f..8be6283 100644 --- a/iocore/net/quic/QUICTypes.h +++ b/iocore/net/quic/QUICTypes.h @@ -251,7 +251,8 @@ enum class QUICStreamType { CLIENT_BIDI, SERVER_BIDI, CLIENT_UNI, SERVER_UNI, HA class QUICTypeUtil { public: - static bool hasLongHeader(const uint8_t *buf); + static bool has_long_header(const uint8_t *buf); + static bool has_connection_id(const uint8_t *buf); static QUICStreamType detect_stream_type(QUICStreamId id); static QUICConnectionId read_QUICConnectionId(const uint8_t *buf, uint8_t n); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].