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

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 09fff5d5019ae2ef1ead1854d4325333fe14c438
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Wed Jul 31 13:47:22 2024 -0600

    Make TSVConnSslConnectionGet available on QUIC connections (#11631)
    
    (cherry picked from commit 52319a9fbbc090a866b958ed929da97592146497)
---
 include/iocore/net/TLSBasicSupport.h | 3 +++
 src/api/InkAPI.cc                    | 9 ++++-----
 src/iocore/net/TLSBasicSupport.cc    | 6 ++++++
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/iocore/net/TLSBasicSupport.h 
b/include/iocore/net/TLSBasicSupport.h
index e7c0d80402..bfa13eed94 100644
--- a/include/iocore/net/TLSBasicSupport.h
+++ b/include/iocore/net/TLSBasicSupport.h
@@ -29,6 +29,8 @@
 #include "tscore/ink_hrtime.h"
 #include "../../../src/iocore/net/P_SSLUtils.h"
 
+using TLSHandle = SSL *;
+
 class TLSBasicSupport
 {
 public:
@@ -39,6 +41,7 @@ public:
   static void             bind(SSL *ssl, TLSBasicSupport *srs);
   static void             unbind(SSL *ssl);
 
+  TLSHandle   get_tls_handle() const;
   const char *get_tls_protocol_name() const;
   const char *get_tls_cipher_suite() const;
   const char *get_tls_curve() const;
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index bc06bd3f9f..1057da355a 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -7831,11 +7831,10 @@ TSVConnTunnel(TSVConn sslp)
 TSSslConnection
 TSVConnSslConnectionGet(TSVConn sslp)
 {
-  TSSslConnection    ssl    = nullptr;
-  NetVConnection    *vc     = reinterpret_cast<NetVConnection *>(sslp);
-  SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(vc);
-  if (ssl_vc != nullptr) {
-    ssl = reinterpret_cast<TSSslConnection>(ssl_vc->ssl);
+  TSSslConnection ssl   = nullptr;
+  NetVConnection *netvc = reinterpret_cast<NetVConnection *>(sslp);
+  if (auto tbs = netvc->get_service<TLSBasicSupport>(); tbs) {
+    ssl = reinterpret_cast<TSSslConnection>(tbs->get_tls_handle());
   }
   return ssl;
 }
diff --git a/src/iocore/net/TLSBasicSupport.cc 
b/src/iocore/net/TLSBasicSupport.cc
index 3a7779fc4d..423213c463 100644
--- a/src/iocore/net/TLSBasicSupport.cc
+++ b/src/iocore/net/TLSBasicSupport.cc
@@ -67,6 +67,12 @@ TLSBasicSupport::clear()
   this->_tls_handshake_end_time   = 0;
 }
 
+TLSHandle
+TLSBasicSupport::get_tls_handle() const
+{
+  return this->_get_ssl_object();
+}
+
 const char *
 TLSBasicSupport::get_tls_protocol_name() const
 {

Reply via email to