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 2022/08/10 02:11:22 UTC

[trafficserver] branch master updated: Make TLSSNISupport::get_sni_server_name public (#9003)

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

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 905ea2cc5 Make TLSSNISupport::get_sni_server_name public (#9003)
905ea2cc5 is described below

commit 905ea2cc5414d9caa0d89f51ea9bf141185f0407
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Aug 10 11:11:15 2022 +0900

    Make TLSSNISupport::get_sni_server_name public (#9003)
---
 iocore/net/P_SNIActionPerformer.h | 8 ++++----
 iocore/net/P_SSLNetVConnection.h  | 2 +-
 iocore/net/TLSSNISupport.cc       | 4 ++--
 iocore/net/TLSSNISupport.h        | 3 ++-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/iocore/net/P_SNIActionPerformer.h b/iocore/net/P_SNIActionPerformer.h
index 29b7e8c1f..8088d25bd 100644
--- a/iocore/net/P_SNIActionPerformer.h
+++ b/iocore/net/P_SNIActionPerformer.h
@@ -50,7 +50,7 @@ public:
   SNIAction(TLSSNISupport *snis, const Context &ctx) const override
   {
     auto ssl_vc            = dynamic_cast<SSLNetVConnection *>(snis);
-    const char *servername = ssl_vc->get_server_name();
+    const char *servername = snis->get_sni_server_name();
     if (ssl_vc) {
       if (!enable_h2) {
         ssl_vc->disableProtocol(TS_ALPN_PROTOCOL_INDEX_HTTP_2_0);
@@ -103,7 +103,7 @@ public:
   {
     // Set the netvc option?
     SSLNetVConnection *ssl_netvc = dynamic_cast<SSLNetVConnection *>(snis);
-    const char *servername       = ssl_netvc->get_server_name();
+    const char *servername       = snis->get_sni_server_name();
     if (ssl_netvc) {
       // If needed, we will try to amend the tunnel destination.
       if (ctx._fqdn_wildcard_captured_groups && need_fix) {
@@ -216,7 +216,7 @@ public:
   SNIAction(TLSSNISupport *snis, const Context &ctx) const override
   {
     auto ssl_vc            = dynamic_cast<SSLNetVConnection *>(snis);
-    const char *servername = ssl_vc->get_server_name();
+    const char *servername = snis->get_sni_server_name();
     Debug("ssl_sni", "action verify param %d, fqdn [%s]", this->mode, servername);
     setClientCertLevel(ssl_vc->ssl, this->mode);
     ssl_vc->set_ca_cert_file(ca_file, ca_dir);
@@ -282,7 +282,7 @@ public:
   {
     if (!unset) {
       auto ssl_vc            = dynamic_cast<SSLNetVConnection *>(snis);
-      const char *servername = ssl_vc->get_server_name();
+      const char *servername = snis->get_sni_server_name();
       Debug("ssl_sni", "TLSValidProtocol param 0%x, fqdn [%s]", static_cast<unsigned int>(this->protocol_mask), servername);
       ssl_vc->set_valid_tls_protocols(protocol_mask, TLSValidProtocols::max_mask);
     }
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index 4b224ecd2..f14ffffba 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -302,7 +302,7 @@ public:
   const char *
   get_server_name() const override
   {
-    return _get_sni_server_name() ? _get_sni_server_name() : "";
+    return get_sni_server_name() ? get_sni_server_name() : "";
   }
 
   bool
diff --git a/iocore/net/TLSSNISupport.cc b/iocore/net/TLSSNISupport.cc
index e36049ad1..b8f64d2b7 100644
--- a/iocore/net/TLSSNISupport.cc
+++ b/iocore/net/TLSSNISupport.cc
@@ -57,7 +57,7 @@ TLSSNISupport::unbind(SSL *ssl)
 int
 TLSSNISupport::perform_sni_action()
 {
-  const char *servername = this->_get_sni_server_name();
+  const char *servername = this->get_sni_server_name();
   if (!servername) {
     Debug("ssl_sni", "No servername provided");
     return SSL_TLSEXT_ERR_OK;
@@ -142,7 +142,7 @@ TLSSNISupport::_clear()
 }
 
 const char *
-TLSSNISupport::_get_sni_server_name() const
+TLSSNISupport::get_sni_server_name() const
 {
   return _sni_server_name.get() ? _sni_server_name.get() : "";
 }
diff --git a/iocore/net/TLSSNISupport.h b/iocore/net/TLSSNISupport.h
index 2f5d6467c..15812b2a9 100644
--- a/iocore/net/TLSSNISupport.h
+++ b/iocore/net/TLSSNISupport.h
@@ -50,6 +50,8 @@ public:
 #endif
   void on_servername(SSL *ssl, int *al, void *arg);
 
+  const char *get_sni_server_name() const;
+
   struct HintsFromSNI {
     std::optional<uint32_t> http2_buffer_water_mark;
   } hints_from_sni;
@@ -58,7 +60,6 @@ protected:
   virtual void _fire_ssl_servername_event() = 0;
 
   void _clear();
-  const char *_get_sni_server_name() const;
 
 private:
   static int _ex_data_index;