trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From masa...@apache.org
Subject [trafficserver] branch quic-latest updated: Cleanup QUICTransportParametersHandler::parse
Date Wed, 10 Jan 2018 06:05:28 GMT
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 4576fc7  Cleanup QUICTransportParametersHandler::parse
4576fc7 is described below

commit 4576fc763dab539f4dbe278fc1a92c4f465acfc2
Author: Masaori Koshiba <masaori@apache.org>
AuthorDate: Wed Jan 10 15:05:15 2018 +0900

    Cleanup QUICTransportParametersHandler::parse
---
 iocore/net/quic/QUICHandshake.cc           |  6 ------
 iocore/net/quic/QUICHandshake.h            |  1 -
 iocore/net/quic/QUICTransportParameters.cc | 29 +++++++++++++++++++----------
 iocore/net/quic/QUICTransportParameters.h  |  2 --
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index f47b4a2..a783510 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -228,12 +228,6 @@ QUICHandshake::remote_transport_parameters()
   return this->_remote_transport_parameters;
 }
 
-NetVConnectionContext_t
-QUICHandshake::netvc_context()
-{
-  return this->_netvc_context;
-}
-
 int
 QUICHandshake::state_initial(int event, Event *data)
 {
diff --git a/iocore/net/quic/QUICHandshake.h b/iocore/net/quic/QUICHandshake.h
index f6c5f49..1f5fbbd 100644
--- a/iocore/net/quic/QUICHandshake.h
+++ b/iocore/net/quic/QUICHandshake.h
@@ -71,7 +71,6 @@ public:
   void negotiated_application_name(const uint8_t **name, unsigned int *len);
   std::shared_ptr<const QUICTransportParameters> local_transport_parameters();
   std::shared_ptr<const QUICTransportParameters> remote_transport_parameters();
-  NetVConnectionContext_t netvc_context();
 
   bool is_version_negotiated();
   bool is_completed();
diff --git a/iocore/net/quic/QUICTransportParameters.cc b/iocore/net/quic/QUICTransportParameters.cc
index 846a664..a75895d 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -30,6 +30,7 @@
 #include "../P_QUICNetVConnection.h"
 
 static constexpr int TRANSPORT_PARAMETERS_MAXIMUM_SIZE = 65535;
+static constexpr char tag[]                            = "quic_handshake";
 
 QUICTransportParameters::Value::Value(const uint8_t *data, uint16_t len) : _len(len)
 {
@@ -301,13 +302,13 @@ QUICTransportParameters::_print() const
 {
   for (auto &p : this->_parameters) {
     if (p.second->len() == 0) {
-      Debug("quic_handsahke", "%s: (no value)", QUICDebugNames::transport_parameter_id(p.first));
+      Debug(tag, "%s: (no value)", QUICDebugNames::transport_parameter_id(p.first));
     } else if (p.second->len() <= 8) {
-      Debug("quic_handsahke", "%s: 0x%" PRIx64 " (%" PRIu64 ")", QUICDebugNames::transport_parameter_id(p.first),
+      Debug(tag, "%s: 0x%" PRIx64 " (%" PRIu64 ")", QUICDebugNames::transport_parameter_id(p.first),
             QUICTypeUtil::read_nbytes_as_uint(p.second->data(), p.second->len()),
             QUICTypeUtil::read_nbytes_as_uint(p.second->data(), p.second->len()));
     } else {
-      Debug("quic_handsahke", "%s: (long data)", QUICDebugNames::transport_parameter_id(p.first));
+      Debug(tag, "%s: (long data)", QUICDebugNames::transport_parameter_id(p.first));
     }
   }
 }
@@ -448,25 +449,25 @@ QUICTransportParametersInEncryptedExtensions::_validate_parameters()
const
       return -1;
     }
   } else {
-    return -1;
+    return -2;
   }
 
   // MAYs
   if ((ite = this->_parameters.find(QUICTransportParameterId::INITIAL_MAX_STREAM_ID_BIDI))
!= this->_parameters.end()) {
     if (ite->second->len() != 4) {
-      return -1;
+      return -3;
     }
     if ((QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())
& 0x03) != 1) {
-      return -1;
+      return -4;
     }
   }
 
   if ((ite = this->_parameters.find(QUICTransportParameterId::INITIAL_MAX_STREAM_ID_UNI))
!= this->_parameters.end()) {
     if (ite->second->len() != 4) {
-      return -1;
+      return -5;
     }
     if ((QUICTypeUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len())
& 0x03) != 3) {
-      return -1;
+      return -6;
     }
   }
 
@@ -500,10 +501,18 @@ QUICTransportParametersHandler::parse(SSL *s, unsigned int ext_type,
unsigned in
 {
   QUICHandshake *hs = static_cast<QUICHandshake *>(SSL_get_ex_data(s, QUIC::ssl_quic_hs_index));
 
-  if (hs->netvc_context() == NET_VCONNECTION_IN) {
+  switch (context) {
+  case SSL_EXT_CLIENT_HELLO: {
     hs->set_transport_parameters(std::make_shared<QUICTransportParametersInClientHello>(in,
inlen));
-  } else {
+    break;
+  }
+  case SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS: {
     hs->set_transport_parameters(std::make_shared<QUICTransportParametersInEncryptedExtensions>(in,
inlen));
+    break;
+  }
+  default:
+    // Do nothing
+    break;
   }
 
   return 1;
diff --git a/iocore/net/quic/QUICTransportParameters.h b/iocore/net/quic/QUICTransportParameters.h
index a3f8000..46aa1b4 100644
--- a/iocore/net/quic/QUICTransportParameters.h
+++ b/iocore/net/quic/QUICTransportParameters.h
@@ -154,9 +154,7 @@ public:
 
   static int add(SSL *s, unsigned int ext_type, unsigned int context, const unsigned char
**out, size_t *outlen, X509 *x,
                  size_t chainidx, int *al, void *add_arg);
-
   static void free(SSL *s, unsigned int ext_type, unsigned int context, const unsigned char
*out, void *add_arg);
-
   static int parse(SSL *s, unsigned int ext_type, unsigned int context, const unsigned char
*in, size_t inlen, X509 *x,
                    size_t chainidx, int *al, void *parse_arg);
 };

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

Mime
View raw message