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 2018/04/05 06:37:14 UTC

[trafficserver] branch quic-latest updated: Randomize Connection ID only if needed - take 2

This is an automated email from the ASF dual-hosted git repository.

masaori 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 308d579  Randomize Connection ID only if needed - take 2
308d579 is described below

commit 308d5794a8f6f225c02eac52e9fb11e1b047045b
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Apr 5 15:31:43 2018 +0900

    Randomize Connection ID only if needed - take 2
    
    Connection ID should not be changed if INITIAL packet is retransmitted
---
 iocore/net/QUICNetVConnection.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index c57ec91..98be94b 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -857,6 +857,14 @@ QUICNetVConnection::_state_handshake_process_retry_packet(QUICPacketUPtr packet)
   this->_largest_received_packet_number = 0;
   this->_stream_manager->reset_recv_offset();
 
+  // Generate new Connection ID
+  QUICConnectionId tmp = this->_original_quic_connection_id;
+  this->_original_quic_connection_id.randomize();
+  QUICConDebug("Connection ID %" PRIx64 " has been changed to %" PRIx64, static_cast<uint64_t>(tmp),
+               static_cast<uint64_t>(this->_original_quic_connection_id));
+
+  this->_hs_protocol->initialize_key_materials(this->_original_quic_connection_id);
+
   return error;
 }
 
@@ -1240,22 +1248,14 @@ QUICNetVConnection::_build_packet(ats_unique_buf buf, size_t len, bool retransmi
       type = QUICPacketType::HANDSHAKE;
     } else if (this->_handshake_handler && this->_handshake_handler->is_completed()) {
       type = QUICPacketType::PROTECTED;
+    } else {
+      Error("Unsupported case");
     }
   }
 
   switch (type) {
   case QUICPacketType::INITIAL:
     ink_assert(this->get_context() == NET_VCONNECTION_OUT);
-
-    if (this->_last_received_packet_type == QUICPacketType::RETRY) {
-      QUICConnectionId tmp = this->_original_quic_connection_id;
-      this->_original_quic_connection_id.randomize();
-      QUICConDebug("Connection ID %" PRIx64 " has been changed to %" PRIx64, static_cast<uint64_t>(tmp),
-                   static_cast<uint64_t>(this->_original_quic_connection_id));
-
-      this->_hs_protocol->initialize_key_materials(this->_original_quic_connection_id);
-    }
-
     packet = this->_packet_factory.create_initial_packet(this->_original_quic_connection_id, this->largest_acked_packet_number(),
                                                          std::move(buf), len);
     this->_handshake_handler->handleEvent(QUIC_EVENT_HANDSHAKE_PACKET_WRITE_COMPLETE, nullptr);

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.