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/03/20 06:43:39 UTC

[trafficserver] branch quic-latest updated: Echo packet number of INITIAL packet in RETRY packet

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 0bf9881  Echo packet number of INITIAL packet in RETRY packet
0bf9881 is described below

commit 0bf98811bcb980b88c2e430e0c2f9accfba910c0
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Mar 20 15:06:07 2018 +0900

    Echo packet number of INITIAL packet in RETRY packet
    
    Following below in section 5.4.2 "Retry Packet" (draft-09)
    
    > The packet number field echoes the packet number field from the triggering client packet.
---
 iocore/net/QUICNetVConnection.cc               | 3 ++-
 iocore/net/quic/QUICPacket.cc                  | 9 ++++++---
 iocore/net/quic/QUICPacket.h                   | 2 +-
 iocore/net/quic/test/test_QUICPacketFactory.cc | 4 ++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 5d6e6ae..c647e93 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1133,7 +1133,8 @@ QUICNetVConnection::_build_packet(ats_unique_buf buf, size_t len, bool retransmi
                                                          QUIC_SUPPORTED_VERSIONS[0], std::move(buf), len);
     break;
   case QUICPacketType::RETRY:
-    packet = this->_packet_factory.create_retry_packet(this->_quic_connection_id, this->largest_acked_packet_number(),
+    // Echo "_largest_received_packet_number" as packet number. Probably this is the packet number from triggering client packet.
+    packet = this->_packet_factory.create_retry_packet(this->_quic_connection_id, this->_largest_received_packet_number,
                                                        std::move(buf), len, retransmittable);
     break;
   case QUICPacketType::HANDSHAKE:
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 610a67b..2d5932a 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -782,12 +782,15 @@ QUICPacketFactory::create_initial_packet(QUICConnectionId connection_id, QUICPac
   return this->_create_encrypted_packet(std::move(header), true);
 }
 
+/*
+ * Unlike other create_*_packet, the 2nd argument is not base packet number.
+ */
 QUICPacketUPtr
-QUICPacketFactory::create_retry_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, ats_unique_buf payload,
+QUICPacketFactory::create_retry_packet(QUICConnectionId connection_id, QUICPacketNumber packet_number, ats_unique_buf payload,
                                        size_t len, bool retransmittable)
 {
-  QUICPacketHeaderUPtr header = QUICPacketHeader::build(QUICPacketType::RETRY, connection_id, this->_packet_number_generator.next(),
-                                                        base_packet_number, this->_version, std::move(payload), len);
+  QUICPacketHeaderUPtr header =
+    QUICPacketHeader::build(QUICPacketType::RETRY, connection_id, packet_number, 0, this->_version, std::move(payload), len);
   return this->_create_encrypted_packet(std::move(header), retransmittable);
 }
 
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 669cbea..cca3571 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -342,7 +342,7 @@ public:
   QUICPacketUPtr create_version_negotiation_packet(const QUICPacket *packet_sent_by_client, QUICPacketNumber base_packet_number);
   QUICPacketUPtr create_initial_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, QUICVersion version,
                                        ats_unique_buf payload, size_t len);
-  QUICPacketUPtr create_retry_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, ats_unique_buf payload,
+  QUICPacketUPtr create_retry_packet(QUICConnectionId connection_id, QUICPacketNumber packet_number, ats_unique_buf payload,
                                      size_t len, bool retransmittable);
   QUICPacketUPtr create_handshake_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number,
                                          ats_unique_buf payload, size_t len, bool retransmittable);
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc b/iocore/net/quic/test/test_QUICPacketFactory.cc
index 3db7a69..e260563 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFactory.cc
@@ -66,11 +66,11 @@ TEST_CASE("QUICPacketFactory_Create_Retry", "[quic]")
   ats_unique_buf payload = ats_unique_malloc(sizeof(raw));
   memcpy(payload.get(), raw, sizeof(raw));
 
-  QUICPacketUPtr packet = factory.create_retry_packet(0x01020304, 0, std::move(payload), sizeof(raw), false);
+  QUICPacketUPtr packet = factory.create_retry_packet(0x01020304, 1234, std::move(payload), sizeof(raw), false);
   CHECK(packet->type() == QUICPacketType::RETRY);
   CHECK(packet->connection_id() == 0x01020304);
   CHECK(memcmp(packet->payload(), raw, sizeof(raw)) == 0);
-  CHECK((packet->packet_number() & 0xFFFFFFFF80000000) == 0);
+  CHECK(packet->packet_number() == 1234);
   CHECK(packet->version() == 0x11223344);
 }
 

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