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 2017/12/18 22:46:46 UTC

[trafficserver] branch quic-latest updated: Validate negotiated version in proper way

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


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 9266834  Validate negotiated version in proper way
9266834 is described below

commit 9266834ec31f5fc83e5e0458a3b3361b281858a7
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Dec 19 02:43:22 2017 +0900

    Validate negotiated version in proper way
---
 iocore/net/quic/QUICHandshake.cc         |  4 ++--
 iocore/net/quic/QUICTypes.h              |  2 +-
 iocore/net/quic/QUICVersionNegotiator.cc | 12 ++++++++----
 iocore/net/quic/QUICVersionNegotiator.h  |  2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index f04a4ef..498c0de 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -177,12 +177,12 @@ QUICHandshake::set_transport_parameters(std::shared_ptr<QUICTransportParameters>
     dynamic_cast<const QUICTransportParametersInClientHello *>(this->_remote_transport_parameters.get());
   if (tp_in_ch) {
     // Version revalidation
-    if (this->_version_negotiator->revalidate(tp_in_ch) != QUICVersionNegotiationStatus::REVALIDATED) {
+    if (this->_version_negotiator->validate(tp_in_ch) != QUICVersionNegotiationStatus::VALIDATED) {
       QUICHSDebug("Version revalidation failed");
       this->_abort_handshake(QUICTransErrorCode::VERSION_NEGOTIATION_ERROR);
       return;
     }
-    QUICHSDebug("Version negotiation revalidated: %x", tp_in_ch->initial_version());
+    QUICHSDebug("Version negotiation validated: %x", tp_in_ch->initial_version());
     return;
   }
 
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index 8be6283..9d9504e 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -106,7 +106,7 @@ enum class QUICFrameType : uint8_t {
 enum class QUICVersionNegotiationStatus {
   NOT_NEGOTIATED, // Haven't negotiated yet
   NEGOTIATED,     // Negotiated
-  REVALIDATED,    // Revalidated in cryptographic handshake
+  VALIDATED,      // Validated with a one in transport parameters
   FAILED,         // Negotiation failed
 };
 
diff --git a/iocore/net/quic/QUICVersionNegotiator.cc b/iocore/net/quic/QUICVersionNegotiator.cc
index 7823054..eba42c2 100644
--- a/iocore/net/quic/QUICVersionNegotiator.cc
+++ b/iocore/net/quic/QUICVersionNegotiator.cc
@@ -41,13 +41,17 @@ QUICVersionNegotiator::negotiate(const QUICPacket *initial_packet)
 }
 
 QUICVersionNegotiationStatus
-QUICVersionNegotiator::revalidate(const QUICTransportParametersInClientHello *tp)
+QUICVersionNegotiator::validate(const QUICTransportParametersInClientHello *tp)
 {
   if (this->_negotiated_version == tp->initial_version()) {
-    this->_status = QUICVersionNegotiationStatus::REVALIDATED;
+    this->_status = QUICVersionNegotiationStatus::VALIDATED;
   } else {
-    this->_status             = QUICVersionNegotiationStatus::FAILED;
-    this->_negotiated_version = 0;
+    if (this->_is_supported(tp->initial_version())) {
+      this->_status             = QUICVersionNegotiationStatus::FAILED;
+      this->_negotiated_version = 0;
+    } else {
+      this->_status = QUICVersionNegotiationStatus::VALIDATED;
+    }
   }
   return this->_status;
 }
diff --git a/iocore/net/quic/QUICVersionNegotiator.h b/iocore/net/quic/QUICVersionNegotiator.h
index 6b7e075..576b625 100644
--- a/iocore/net/quic/QUICVersionNegotiator.h
+++ b/iocore/net/quic/QUICVersionNegotiator.h
@@ -36,7 +36,7 @@ class QUICVersionNegotiator
 public:
   QUICVersionNegotiationStatus status();
   QUICVersionNegotiationStatus negotiate(const QUICPacket *initial_packet);
-  QUICVersionNegotiationStatus revalidate(const QUICTransportParametersInClientHello *tp);
+  QUICVersionNegotiationStatus validate(const QUICTransportParametersInClientHello *tp);
   QUICVersion negotiated_version();
 
 private:

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].