trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] branch quic-latest updated: Use unprotected packet for Version Negotiation Packets
Date Wed, 29 Nov 2017 01:17:38 GMT
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 aac32c9  Use unprotected packet for Version Negotiation Packets
aac32c9 is described below

commit aac32c9aa000b8c2fbd0aef7bdbb0801de51617b
Author: Masakazu Kitajo <maskit@apache.org>
AuthorDate: Wed Nov 29 10:16:55 2017 +0900

    Use unprotected packet for Version Negotiation Packets
---
 iocore/net/quic/QUICPacket.cc | 15 ++++++++++++++-
 iocore/net/quic/QUICPacket.h  |  1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 4c173dd..d3290d9 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -715,7 +715,7 @@ QUICPacketFactory::create_version_negotiation_packet(const QUICPacket
*packet_se
   QUICPacketHeader *header = QUICPacketHeader::build(QUICPacketType::VERSION_NEGOTIATION,
packet_sent_by_client->connection_id(),
                                                      packet_sent_by_client->packet_number(),
base_packet_number,
                                                      packet_sent_by_client->version(),
std::move(versions), len);
-  return this->_create_encrypted_packet(header);
+  return this->_create_unprotected_packet(header);
 }
 
 QUICPacketUPtr
@@ -750,6 +750,19 @@ QUICPacketFactory::create_client_initial_packet(QUICConnectionId connection_id,
 }
 
 QUICPacketUPtr
+QUICPacketFactory::_create_unprotected_packet(QUICPacketHeader *header)
+{
+  ats_unique_buf cleartext = ats_unique_malloc(2048);
+  size_t cleartext_len     = header->payload_size();
+
+  memcpy(cleartext.get(), header->payload(), cleartext_len);
+  QUICPacket *packet = quicPacketAllocator.alloc();
+  new (packet) QUICPacket(header, std::move(cleartext), cleartext_len, false);
+
+  return QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet);
+}
+
+QUICPacketUPtr
 QUICPacketFactory::_create_encrypted_packet(QUICPacketHeader *header)
 {
   // TODO: use pmtu of UnixNetVConnection
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 42d40e6..d57f12e 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -309,5 +309,6 @@ private:
   QUICCrypto *_crypto  = nullptr;
   QUICPacketNumberGenerator _packet_number_generator;
 
+  QUICPacketUPtr _create_unprotected_packet(QUICPacketHeader *header);
   QUICPacketUPtr _create_encrypted_packet(QUICPacketHeader *header);
 };

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message