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/01/27 16:39:47 UTC

[trafficserver] branch quic-latest updated (186ddfb -> 3420f3e)

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

maskit pushed a change to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from 186ddfb  clang-format
     new e3ad67a  Remove QUICConnection::reset_connection_id()
     new 90ea93d  Make tests compilable
     new 3420f3e  Fix tests for TransportParameters

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/P_QUICNetVConnection.h                  |  1 -
 iocore/net/P_QUICPacketHandler.h                   |  2 +-
 iocore/net/QUICNetVConnection.cc                   | 19 +++++++---
 iocore/net/QUICPacketHandler.cc                    | 43 ++++++----------------
 iocore/net/quic/Mock.h                             |  2 +-
 iocore/net/quic/QUICConnection.h                   |  5 ---
 iocore/net/quic/QUICPacket.cc                      | 16 ++++++++
 iocore/net/quic/QUICPacket.h                       |  2 +
 iocore/net/quic/QUICTypes.cc                       |  2 +-
 iocore/net/quic/test/Makefile.am                   |  2 +
 .../net/quic/test/test_QUICTransportParameters.cc  |  8 ++--
 11 files changed, 52 insertions(+), 50 deletions(-)

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

[trafficserver] 03/03: Fix tests for TransportParameters

Posted by ma...@apache.org.
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

commit 3420f3eb702c7eb7cbb3e57e4988b2e8bcded1d6
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Sun Jan 28 00:33:57 2018 +0900

    Fix tests for TransportParameters
---
 iocore/net/quic/test/test_QUICTransportParameters.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/iocore/net/quic/test/test_QUICTransportParameters.cc b/iocore/net/quic/test/test_QUICTransportParameters.cc
index 2825f2d..cc73714 100644
--- a/iocore/net/quic/test/test_QUICTransportParameters.cc
+++ b/iocore/net/quic/test/test_QUICTransportParameters.cc
@@ -43,7 +43,7 @@ TEST_CASE("QUICTransportParametersInClientHello_read", "[quic]")
       0x0a, 0x0b, 0x0c, 0x0d, // value
       0x00, 0x03,             // parameter id
       0x00, 0x02,             // length of value
-      0xab, 0xcd,             // value
+      0x01, 0x23,             // value
     };
 
     QUICTransportParametersInClientHello params_in_ch(buf, sizeof(buf));
@@ -67,7 +67,7 @@ TEST_CASE("QUICTransportParametersInClientHello_read", "[quic]")
 
     data = params_in_ch.getAsBytes(QUICTransportParameterId::IDLE_TIMEOUT, len);
     CHECK(len == 2);
-    CHECK(memcmp(data, "\xab\xcd", 2) == 0);
+    CHECK(memcmp(data, "\x01\x23", 2) == 0);
 
     data = params_in_ch.getAsBytes(QUICTransportParameterId::MAX_PACKET_SIZE, len);
     CHECK(len == 0);
@@ -145,7 +145,7 @@ TEST_CASE("QUICTransportParametersInEncryptedExtensions_read", "[quic]")
                      0x12, 0x34, 0x56, 0x78, // value
                      0x00, 0x03,             // parameter id
                      0x00, 0x02,             // length of value
-                     0x0a, 0x0b,             // value
+                     0x01, 0x23,             // value
                      0x00, 0x06,             // parameter id
                      0x00, 0x10,             // length of value
                      0x00, 0x10, 0x20, 0x30, // value
@@ -168,7 +168,7 @@ TEST_CASE("QUICTransportParametersInEncryptedExtensions_read", "[quic]")
 
     data = params_in_ee.getAsBytes(QUICTransportParameterId::IDLE_TIMEOUT, len);
     CHECK(len == 2);
-    CHECK(memcmp(data, "\x0a\x0b", 2) == 0);
+    CHECK(memcmp(data, "\x01\x23", 2) == 0);
 
     data = params_in_ee.getAsBytes(QUICTransportParameterId::STATELESS_RESET_TOKEN, len);
     CHECK(len == 16);

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

[trafficserver] 01/03: Remove QUICConnection::reset_connection_id()

Posted by ma...@apache.org.
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

commit e3ad67a5094a768705c473eefd3b5afddfc69792
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Sat Jan 27 23:48:59 2018 +0900

    Remove QUICConnection::reset_connection_id()
---
 iocore/net/P_QUICNetVConnection.h |  1 -
 iocore/net/P_QUICPacketHandler.h  |  2 +-
 iocore/net/QUICNetVConnection.cc  | 19 +++++++++++------
 iocore/net/QUICPacketHandler.cc   | 43 +++++++++++----------------------------
 iocore/net/quic/QUICConnection.h  |  5 -----
 iocore/net/quic/QUICPacket.cc     | 16 +++++++++++++++
 iocore/net/quic/QUICPacket.h      |  2 ++
 iocore/net/quic/QUICTypes.cc      |  2 +-
 8 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index 5b47b75..a6e2b88 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -176,7 +176,6 @@ public:
   // QUICConnection
   QUICConnectionId original_connection_id() override;
   QUICConnectionId connection_id() override;
-  void reset_connection_id(QUICConnectionId cid) override;
   uint32_t maximum_quic_packet_size() override;
   uint32_t minimum_quic_packet_size() override;
   uint32_t maximum_stream_frame_data_size() override;
diff --git a/iocore/net/P_QUICPacketHandler.h b/iocore/net/P_QUICPacketHandler.h
index 2205a80..8fce956 100644
--- a/iocore/net/P_QUICPacketHandler.h
+++ b/iocore/net/P_QUICPacketHandler.h
@@ -39,7 +39,7 @@ public:
 
 protected:
   static void _send_packet(Continuation *c, const QUICPacket &packet, UDPConnection *udp_con, IpEndpoint &addr, uint32_t pmtu);
-  static bool _read_connection_id(QUICConnectionId &cid, IOBufferBlock *block);
+  static QUICConnectionId _read_connection_id(IOBufferBlock *block);
 
   virtual void _recv_packet(int event, UDPPacket *udpPacket) = 0;
 };
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 57e4f06..d940603 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -187,12 +187,6 @@ QUICNetVConnection::connection_id()
   return this->_quic_connection_id;
 }
 
-void
-QUICNetVConnection::reset_connection_id(QUICConnectionId cid)
-{
-  this->_quic_connection_id = cid;
-}
-
 uint32_t
 QUICNetVConnection::pmtu()
 {
@@ -1038,6 +1032,19 @@ QUICNetVConnection::_dequeue_recv_packet(QUICPacketCreationResult &result)
     result = QUICPacketCreationResult::NOT_READY;
     return quic_packet;
   }
+
+  if (this->direction() == NET_VCONNECTION_OUT) {
+    // Reset CID if a server sent back a new CID
+    // FIXME This should happen only once
+    IOBufferBlock *block = udp_packet->getIOBlockChain();
+    if (QUICTypeUtil::has_connection_id(reinterpret_cast<const uint8_t *>(block->buf()))) {
+      QUICConnectionId cid = QUICPacket::connection_id(reinterpret_cast<const uint8_t *>(block->buf()));
+      if (this->_quic_connection_id != cid) {
+        this->_quic_connection_id = cid;
+      }
+    }
+  }
+
   net_activity(this, this_ethread());
 
   // Create a QUIC packet
diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc
index b4c32ef..bdbd261 100644
--- a/iocore/net/QUICPacketHandler.cc
+++ b/iocore/net/QUICPacketHandler.cc
@@ -49,25 +49,11 @@ QUICPacketHandler::_send_packet(Continuation *c, const QUICPacket &packet, UDPCo
   udp_con->send(c, udp_packet);
 }
 
-// TODO: Integrate with QUICPacketHeader::connection_id()
-bool
-QUICPacketHandler::_read_connection_id(QUICConnectionId &cid, IOBufferBlock *block)
+QUICConnectionId
+QUICPacketHandler::_read_connection_id(IOBufferBlock *block)
 {
-  const uint8_t *buf       = reinterpret_cast<const uint8_t *>(block->buf());
-  const uint8_t cid_offset = 1;
-  const uint8_t cid_len    = 8;
-
-  if (QUICTypeUtil::has_long_header(buf)) {
-    cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len);
-  } else {
-    if (QUICTypeUtil::has_connection_id(buf)) {
-      cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len);
-    } else {
-      return false;
-    }
-  }
-
-  return true;
+  const uint8_t *buf = reinterpret_cast<const uint8_t *>(block->buf());
+  return QUICPacket::connection_id(buf);
 }
 
 //
@@ -141,19 +127,19 @@ QUICPacketHandlerIn::_recv_packet(int event, UDPPacket *udp_packet)
   IOBufferBlock *block = udp_packet->getIOBlockChain();
 
   QUICConnectionId cid;
-  bool res = this->_read_connection_id(cid, block);
+  if (QUICTypeUtil::has_connection_id(reinterpret_cast<const uint8_t *>(block->buf()))) {
+    cid = this->_read_connection_id(block);
+  } else {
+    // TODO: find cid from five tuples
+    ink_assert(false);
+  }
 
   ip_port_text_buffer ipb;
   Debug("quic_sec", "[%" PRIx64 "] received packet from %s, size=%" PRId64, static_cast<uint64_t>(cid),
         ats_ip_nptop(&udp_packet->from.sa, ipb, sizeof(ipb)), udp_packet->getPktLength());
 
   QUICNetVConnection *vc = nullptr;
-  if (res) {
-    vc = this->_connections.get(cid);
-  } else {
-    // TODO: find vc from five tuples
-    ink_assert(false);
-  }
+  vc                     = this->_connections.get(cid);
 
   if (!vc) {
     Connection con;
@@ -277,17 +263,12 @@ QUICPacketHandlerOut::_recv_packet(int event, UDPPacket *udp_packet)
 {
   IOBufferBlock *block = udp_packet->getIOBlockChain();
 
-  QUICConnectionId cid;
-  this->_read_connection_id(cid, block);
+  QUICConnectionId cid = this->_read_connection_id(block);
 
   ip_port_text_buffer ipb;
   Debug("quic_sec", "[%" PRIx64 "] received packet from %s, size=%" PRId64, static_cast<uint64_t>(cid),
         ats_ip_nptop(&udp_packet->from.sa, ipb, sizeof(ipb)), udp_packet->getPktLength());
 
-  if (this->_vc->connection_id() != cid) {
-    this->_vc->reset_connection_id(cid);
-  }
-
   this->_vc->push_packet(udp_packet);
   eventProcessor.schedule_imm(this->_vc, ET_CALL, QUIC_EVENT_PACKET_READ_READY, nullptr);
 }
diff --git a/iocore/net/quic/QUICConnection.h b/iocore/net/quic/QUICConnection.h
index 98d7abd..c2df2f3 100644
--- a/iocore/net/quic/QUICConnection.h
+++ b/iocore/net/quic/QUICConnection.h
@@ -40,11 +40,6 @@ public:
   virtual QUICConnectionId connection_id()          = 0;
 
   /*
-   * Server chooses a new value for the connection ID and client needs to reset it.
-   */
-  virtual void reset_connection_id(QUICConnectionId cid) = 0;
-
-  /*
    * Retruns the maximum packet size at the time called
    *
    * The size depends on PMTU.
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 097a67e..10c5347 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -629,6 +629,22 @@ QUICPacket::decode_packet_number(QUICPacketNumber &dst, QUICPacketNumber src, si
   return true;
 }
 
+QUICConnectionId
+QUICPacket::connection_id(const uint8_t *buf)
+{
+  constexpr uint8_t cid_offset = 1;
+  constexpr uint8_t cid_len    = 8;
+  QUICConnectionId cid;
+  if (QUICTypeUtil::has_long_header(buf)) {
+    cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len);
+  } else {
+    ink_assert(QUICTypeUtil::has_connection_id(buf));
+    cid = QUICTypeUtil::read_QUICConnectionId(buf + cid_offset, cid_len);
+  }
+
+  return cid;
+}
+
 //
 // QUICPacketFactory
 //
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index a392eb5..a7d554d 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -220,6 +220,8 @@ public:
   const uint8_t *payload() const;
   bool is_retransmittable() const;
 
+  static QUICConnectionId connection_id(const uint8_t *packet);
+
   /*
    * Size of whole QUIC packet (header + payload + integrity check)
    */
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index 399df5c..a622bd5 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -38,7 +38,7 @@ QUICTypeUtil::has_long_header(const uint8_t *buf)
 bool
 QUICTypeUtil::has_connection_id(const uint8_t *buf)
 {
-  return (buf[0] & 0x40) == 0;
+  return ((buf[0] & 0x80) != 0) || ((buf[0] & 0x40) == 0);
 }
 
 bool

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

[trafficserver] 02/03: Make tests compilable

Posted by ma...@apache.org.
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

commit 90ea93d5e7cc0a2f79075067ea155118a0380c90
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Sun Jan 28 00:33:36 2018 +0900

    Make tests compilable
---
 iocore/net/quic/Mock.h           | 2 +-
 iocore/net/quic/test/Makefile.am | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index a25fea8..5b446cb 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -453,7 +453,7 @@ class MockQUICCrypto : public QUICCrypto
 public:
   MockQUICCrypto() : QUICCrypto() {}
 
-  bool
+  int
   handshake(uint8_t *out, size_t &out_len, size_t max_out_len, const uint8_t *in, size_t in_len) override
   {
     return true;
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index 7c9a303..51c1c19 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -363,6 +363,8 @@ test_QUICCrypto_LDADD = \
   @OPENSSL_LIBS@ \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/proxy/shared/libUglyLogStubs.a \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a
 
 test_QUICCrypto_SOURCES = \

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