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 52319a9fbb Make TSVConnSslConnectionGet available on QUIC connections
(#11631)
52319a9fbb is described below
commit 52319a9fbbc090a866b958ed929da97592146497
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Wed Jul 31 13:47:22 2024 -0600
Make TSVConnSslConnectionGet available on QUIC connections (#11631)
---
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 446b31ddf9..4d64f4325c 100644
--- a/include/iocore/net/TLSBasicSupport.h
+++ b/include/iocore/net/TLSBasicSupport.h
@@ -29,6 +29,8 @@
#include "tscore/ink_hrtime.h"
#include "iocore/net/SSLTypes.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 56e3c34ba9..0fc7c50a19 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -7921,11 +7921,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 c03ab9e197..d9b4d1e40b 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
{