You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/09/03 15:19:52 UTC

[trafficserver] branch 9.0.x updated: Don't make an error on duplicated RETIRE_CONNECTION frames (#7131)

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

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 4387a61  Don't make an error on duplicated RETIRE_CONNECTION frames (#7131)
4387a61 is described below

commit 4387a61820d7417411a25358f9aee3691acb3aee
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Sep 2 10:10:45 2020 +0900

    Don't make an error on duplicated RETIRE_CONNECTION frames (#7131)
    
    (cherry picked from commit 25d13c1b33117d1969971fa4c10b55077438d880)
---
 iocore/net/quic/QUICAltConnectionManager.cc | 9 ++++-----
 iocore/net/quic/QUICAltConnectionManager.h  | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/iocore/net/quic/QUICAltConnectionManager.cc b/iocore/net/quic/QUICAltConnectionManager.cc
index 3e95724..770f5f9 100644
--- a/iocore/net/quic/QUICAltConnectionManager.cc
+++ b/iocore/net/quic/QUICAltConnectionManager.cc
@@ -134,18 +134,15 @@ QUICAltConnectionManager::_init_alt_connection_ids()
   this->_need_advertise = true;
 }
 
-bool
+void
 QUICAltConnectionManager::_update_alt_connection_id(uint64_t chosen_seq_num)
 {
   for (int i = 0; i < this->_remote_active_cid_limit; ++i) {
     if (this->_alt_quic_connection_ids_local[i].seq_num == chosen_seq_num) {
       this->_alt_quic_connection_ids_local[i] = this->_generate_next_alt_con_info();
       this->_need_advertise                   = true;
-      return true;
     }
   }
-
-  return false;
 }
 
 QUICConnectionErrorUPtr
@@ -183,9 +180,11 @@ QUICAltConnectionManager::_retire_remote_connection_id(const QUICRetireConnectio
 {
   QUICConnectionErrorUPtr error = nullptr;
 
-  if (!this->_update_alt_connection_id(frame.seq_num())) {
+  if (frame.seq_num() > this->_alt_quic_connection_id_seq_num) {
     error = std::make_unique<QUICConnectionError>(QUICTransErrorCode::PROTOCOL_VIOLATION, "received unused sequence number",
                                                   QUICFrameType::RETIRE_CONNECTION_ID);
+  } else {
+    this->_update_alt_connection_id(frame.seq_num());
   }
   return error;
 }
diff --git a/iocore/net/quic/QUICAltConnectionManager.h b/iocore/net/quic/QUICAltConnectionManager.h
index 6c55932..ade5f89 100644
--- a/iocore/net/quic/QUICAltConnectionManager.h
+++ b/iocore/net/quic/QUICAltConnectionManager.h
@@ -110,7 +110,7 @@ private:
 
   AltConnectionInfo _generate_next_alt_con_info();
   void _init_alt_connection_ids();
-  bool _update_alt_connection_id(uint64_t chosen_seq_num);
+  void _update_alt_connection_id(uint64_t chosen_seq_num);
 
   void _records_new_connection_id_frame(QUICEncryptionLevel level, const QUICNewConnectionIdFrame &frame);
   void _records_retire_connection_id_frame(QUICEncryptionLevel, const QUICRetireConnectionIdFrame &frame);