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/08/03 07:24:34 UTC

[trafficserver] branch quic-latest updated (3454522 -> c0f4400)

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

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


    from 3454522  [draft-13] Add Frame Type field in CONNECTION_CLOSE frame
     new 17e6ab5  Check value of Reason Phrase Length of CONNECTION_CLOSE frame
     new 795ba9b  Print maximum_(stream)_data on debug log
     new c0f4400  Remove unnecessary checks before generate_frame() calls

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/QUICNetVConnection.cc | 73 +++++++++++++++++++---------------------
 iocore/net/quic/QUICFrame.cc     | 22 ++++++++++--
 iocore/net/quic/QUICFrame.h      |  4 +++
 3 files changed, 59 insertions(+), 40 deletions(-)


[trafficserver] 01/03: Check value of Reason Phrase Length of CONNECTION_CLOSE frame

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

commit 17e6ab5be1704105eef4a8a721b81cec00d326e0
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Aug 3 10:33:18 2018 +0900

    Check value of Reason Phrase Length of CONNECTION_CLOSE frame
---
 iocore/net/quic/QUICFrame.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 2b3f669..7aca81b 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -1300,7 +1300,7 @@ QUICConnectionCloseFrame::debug_msg(char *msg, size_t msg_len) const
   int len = snprintf(msg, msg_len, "| CONNECTION_CLOSE size=%zu code=%s frame=%s", this->size(),
                      QUICDebugNames::error_code(this->error_code()), QUICDebugNames::frame_type(this->frame_type()));
 
-  if (this->reason_phrase_length() != 0) {
+  if (this->reason_phrase_length() != 0 && this->reason_phrase() != nullptr) {
     memcpy(msg + len, " reason=", 8);
     len += 8;
 
@@ -1346,7 +1346,13 @@ uint64_t
 QUICConnectionCloseFrame::reason_phrase_length() const
 {
   if (this->_buf) {
-    return QUICIntUtil::read_QUICVariableInt(this->_buf + this->_get_reason_phrase_length_field_offset());
+    size_t offset              = this->_get_reason_phrase_length_field_offset();
+    uint64_t reason_phrase_len = QUICIntUtil::read_QUICVariableInt(this->_buf + offset);
+    if (reason_phrase_len > this->_len - offset) {
+      reason_phrase_len = this->_len - offset;
+    }
+
+    return reason_phrase_len;
   } else {
     return this->_reason_phrase_length;
   }


[trafficserver] 02/03: Print maximum_(stream)_data on debug log

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

commit 795ba9b89e788858e470138dfc9958a4f4c37205
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Aug 3 14:00:09 2018 +0900

    Print maximum_(stream)_data on debug log
---
 iocore/net/quic/QUICFrame.cc | 12 ++++++++++++
 iocore/net/quic/QUICFrame.h  |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 7aca81b..71ae896 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -1564,6 +1564,12 @@ QUICMaxDataFrame::store(uint8_t *buf, size_t *len, size_t limit) const
   return *len;
 }
 
+int
+QUICMaxDataFrame::debug_msg(char *msg, size_t msg_len) const
+{
+  return snprintf(msg, msg_len, "| MAX_DATA size=%zu maximum=%" PRIu64, this->size(), this->maximum_data());
+}
+
 uint64_t
 QUICMaxDataFrame::maximum_data() const
 {
@@ -1636,6 +1642,12 @@ QUICMaxStreamDataFrame::store(uint8_t *buf, size_t *len, size_t limit) const
   return *len;
 }
 
+int
+QUICMaxStreamDataFrame::debug_msg(char *msg, size_t msg_len) const
+{
+  return snprintf(msg, msg_len, "| MAX_STREAM_DATA size=%zu maximum=%" PRIu64, this->size(), this->maximum_stream_data());
+}
+
 QUICStreamId
 QUICMaxStreamDataFrame::stream_id() const
 {
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index d4feb26..a82ac07 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -418,6 +418,8 @@ public:
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual size_t store(uint8_t *buf, size_t *len, size_t limit) const override;
+  virtual int debug_msg(char *msg, size_t msg_len) const override;
+
   uint64_t maximum_data() const;
 
 private:
@@ -440,6 +442,8 @@ public:
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual size_t store(uint8_t *buf, size_t *len, size_t limit) const override;
+  virtual int debug_msg(char *msg, size_t msg_len) const override;
+
   QUICStreamId stream_id() const;
   uint64_t maximum_stream_data() const;
 


[trafficserver] 03/03: Remove unnecessary checks before generate_frame() calls

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

commit c0f4400280d8ac033c497ab1f598a7526f1aefec
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Aug 3 16:23:48 2018 +0900

    Remove unnecessary checks before generate_frame() calls
---
 iocore/net/QUICNetVConnection.cc | 73 +++++++++++++++++++---------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 93e8143..f9f48f1 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1305,35 +1305,36 @@ QUICNetVConnection::_packetize_frames(QUICEncryptionLevel level, uint64_t max_pa
   }
 
   // CRYPTO
-  if (this->_handshake_handler->will_generate_frame(level)) {
+  frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
+  while (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
     frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
-    while (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-      frame = this->_handshake_handler->generate_frame(level, UINT16_MAX, max_frame_size);
-    }
   }
 
   // ACK
-  if (this->_ack_frame_creator.will_generate_frame(level)) {
-    frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
-    if (frame != nullptr) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
+  if (will_be_ack_only) {
+    if (this->_ack_frame_creator.will_generate_frame(level)) {
+      frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
     }
+  } else {
+    frame = this->_ack_frame_creator.generate_frame(level, UINT16_MAX, max_frame_size);
+  }
+
+  if (frame != nullptr) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
   }
 
   // PATH_CHALLENGE, PATH_RESPOSNE
-  if (this->_path_validator->will_generate_frame(level)) {
-    frame = this->_path_validator->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
-    if (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-    }
+  frame = this->_path_validator->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
+  if (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
   }
 
   // NEW_CONNECTION_ID
-  if (this->_alt_con_manager && this->_alt_con_manager->will_generate_frame(level)) {
+  if (this->_alt_con_manager) {
     frame = this->_alt_con_manager->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
     while (frame) {
       ++frame_count;
@@ -1344,31 +1345,27 @@ QUICNetVConnection::_packetize_frames(QUICEncryptionLevel level, uint64_t max_pa
   }
 
   // Lost frames
-  if (this->_packet_retransmitter.will_generate_frame(level)) {
-    frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
-    while (frame) {
-      ++frame_count;
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
+  frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
+  while (frame) {
+    ++frame_count;
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
 
-      frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
-    }
+    frame = this->_packet_retransmitter.generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
   }
 
   // STREAM, MAX_STREAM_DATA, STREAM_BLOCKED
-  if (this->_stream_manager->will_generate_frame(level)) {
-    frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
-    while (frame) {
-      ++frame_count;
-      if (frame->type() == QUICFrameType::STREAM) {
-        int ret = this->_remote_flow_controller->update(this->_stream_manager->total_offset_sent());
-        QUICFCDebug("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
-                    this->_remote_flow_controller->current_limit());
-        ink_assert(ret == 0);
-      }
-      this->_store_frame(buf, len, max_frame_size, std::move(frame));
-
-      frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
+  frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
+  while (frame) {
+    ++frame_count;
+    if (frame->type() == QUICFrameType::STREAM) {
+      int ret = this->_remote_flow_controller->update(this->_stream_manager->total_offset_sent());
+      QUICFCDebug("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
+                  this->_remote_flow_controller->current_limit());
+      ink_assert(ret == 0);
     }
+    this->_store_frame(buf, len, max_frame_size, std::move(frame));
+
+    frame = this->_stream_manager->generate_frame(level, this->_remote_flow_controller->credit(), max_frame_size);
   }
 
   // Schedule a packet