From a092c2607324d472fe03eb5d793aae953826bcff Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Tue, 21 Mar 2023 12:40:24 +0000 Subject: [PATCH 1/2] Add TS_HAS_QUICHE feature variable. Some of the quic features may only work with the quiche implementation. Having this will make easy in particular for unit tests to opt out depending of the variable value. --- configure.ac | 1 + doc/developer-guide/testing/blackbox-testing.en.rst | 1 + include/tscore/ink_config.h.in | 1 + src/traffic_layout/info.cc | 1 + tests/README.md | 1 + 5 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index a5b2b498ac8..bd11a61e33a 100644 --- a/configure.ac +++ b/configure.ac @@ -1452,6 +1452,7 @@ enable_quic=yes AM_CONDITIONAL([ENABLE_QUIC], [test "x$enable_quic" = "xyes"]) TS_ARG_ENABLE_VAR([use], [quic]) AC_SUBST(use_quic) +AC_SUBST(has_quiche) fi # Check for optional WAVM library diff --git a/doc/developer-guide/testing/blackbox-testing.en.rst b/doc/developer-guide/testing/blackbox-testing.en.rst index 3544a49c6a6..2db9ca17b48 100644 --- a/doc/developer-guide/testing/blackbox-testing.en.rst +++ b/doc/developer-guide/testing/blackbox-testing.en.rst @@ -255,6 +255,7 @@ Condition Testing - TS_USE_SET_RBIO - TS_USE_TLS13 - TS_USE_QUIC + - TS_HAS_QUICHE - TS_USE_LINUX_NATIVE_AIO - TS_HAS_SO_PEERCRED - TS_USE_REMOTE_UNWINDING diff --git a/include/tscore/ink_config.h.in b/include/tscore/ink_config.h.in index b09ef2868ba..80a2dfcf54b 100644 --- a/include/tscore/ink_config.h.in +++ b/include/tscore/ink_config.h.in @@ -76,6 +76,7 @@ #define TS_USE_GET_DH_2048_256 @use_dh_get_2048_256@ #define TS_USE_TLS13 @use_tls13@ #define TS_USE_QUIC @use_quic@ +#define TS_HAS_QUICHE @has_quiche@ #define TS_USE_TLS_SET_CIPHERSUITES @use_tls_set_ciphersuites@ #define TS_HAS_TLS_KEYLOGGING @has_tls_keylogging@ #define TS_USE_LINUX_NATIVE_AIO @use_linux_native_aio@ diff --git a/src/traffic_layout/info.cc b/src/traffic_layout/info.cc index b5fc8301e09..f9b58aaa47e 100644 --- a/src/traffic_layout/info.cc +++ b/src/traffic_layout/info.cc @@ -115,6 +115,7 @@ produce_features(bool json) print_feature("TS_USE_SET_RBIO", TS_USE_SET_RBIO, json); print_feature("TS_USE_TLS13", TS_USE_TLS13, json); print_feature("TS_USE_QUIC", TS_USE_QUIC, json); + print_feature("TS_HAS_QUICHE", TS_HAS_QUICHE, json); print_feature("TS_USE_LINUX_NATIVE_AIO", TS_USE_LINUX_NATIVE_AIO, json); print_feature("TS_HAS_SO_PEERCRED", TS_HAS_SO_PEERCRED, json); print_feature("TS_USE_REMOTE_UNWINDING", TS_USE_REMOTE_UNWINDING, json); diff --git a/tests/README.md b/tests/README.md index aa972c78642..bda01046e53 100644 --- a/tests/README.md +++ b/tests/README.md @@ -314,6 +314,7 @@ ts.Disk.remap_config.AddLine( * TS_USE_SET_RBIO * TS_USE_TLS13 * TS_USE_QUIC + * TS_HAS_QUICHE * TS_USE_LINUX_NATIVE_AIO * TS_HAS_SO_PEERCRED * TS_USE_REMOTE_UNWINDING From 19a6553c07f37750fa3503044a100e92d8ad0a6b Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Tue, 21 Mar 2023 17:37:17 +0000 Subject: [PATCH 2/2] Replace HAVE_QUICHE_H with TS_HAS_QUICHE --- iocore/net/P_QUICNet.h | 2 +- iocore/net/P_QUICNetProcessor.h | 2 +- iocore/net/P_QUICNetVConnection.h | 2 +- iocore/net/P_QUICNextProtocolAccept.h | 2 +- iocore/net/P_QUICPacketHandler.h | 2 +- iocore/net/QUICNet.cc | 4 ++-- iocore/net/quic/Mock.h | 8 ++++---- iocore/net/quic/QUICContext.cc | 4 ++-- iocore/net/quic/QUICContext.h | 6 +++--- iocore/net/quic/QUICGlobals.cc | 2 +- proxy/http3/test/test_QPACK.cc | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/iocore/net/P_QUICNet.h b/iocore/net/P_QUICNet.h index 4e452bb7026..83f2795a524 100644 --- a/iocore/net/P_QUICNet.h +++ b/iocore/net/P_QUICNet.h @@ -65,7 +65,7 @@ struct QUICPollCont : public Continuation { Que(UDPPacketInternal, link) _longInQueue; private: -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE void _process_packet(QUICPollEvent *e, NetHandler *nh); #else void _process_short_header_packet(QUICPollEvent *e, NetHandler *nh); diff --git a/iocore/net/P_QUICNetProcessor.h b/iocore/net/P_QUICNetProcessor.h index 9a4d6c97721..0c6f8763f5a 100644 --- a/iocore/net/P_QUICNetProcessor.h +++ b/iocore/net/P_QUICNetProcessor.h @@ -25,7 +25,7 @@ #include "tscore/ink_config.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "P_QUICNetProcessor_quiche.h" #else #include "P_QUICNetProcessor_native.h" diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index 53922bd3ee5..79a6228c393 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -25,7 +25,7 @@ #include "tscore/ink_config.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "P_QUICNetVConnection_quiche.h" #else #include "P_QUICNetVConnection_native.h" diff --git a/iocore/net/P_QUICNextProtocolAccept.h b/iocore/net/P_QUICNextProtocolAccept.h index a950fa11c3f..f758590808c 100644 --- a/iocore/net/P_QUICNextProtocolAccept.h +++ b/iocore/net/P_QUICNextProtocolAccept.h @@ -25,7 +25,7 @@ #include "tscore/ink_config.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "P_QUICNextProtocolAccept_quiche.h" #else #include "P_QUICNextProtocolAccept_native.h" diff --git a/iocore/net/P_QUICPacketHandler.h b/iocore/net/P_QUICPacketHandler.h index 4ec56a5ae8b..ac11875a2e3 100644 --- a/iocore/net/P_QUICPacketHandler.h +++ b/iocore/net/P_QUICPacketHandler.h @@ -25,7 +25,7 @@ #include "tscore/ink_config.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "P_QUICPacketHandler_quiche.h" #else #include "P_QUICPacketHandler_native.h" diff --git a/iocore/net/QUICNet.cc b/iocore/net/QUICNet.cc index b14cda3ae75..4d49f2deacb 100644 --- a/iocore/net/QUICNet.cc +++ b/iocore/net/QUICNet.cc @@ -60,7 +60,7 @@ QUICPollCont::QUICPollCont(Ptr &m, NetHandler *nh) : Continuation(m. QUICPollCont::~QUICPollCont() {} -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE void QUICPollCont::_process_packet(QUICPollEvent *e, NetHandler *nh) { @@ -168,7 +168,7 @@ QUICPollCont::pollEvent(int, Event *) } while ((e = result.pop())) { -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE this->_process_packet(e, nh); #else uint8_t *buf; diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h index a096afcaf2c..d87d4336ba1 100644 --- a/iocore/net/quic/Mock.h +++ b/iocore/net/quic/Mock.h @@ -27,7 +27,7 @@ #include "QUICApplication.h" #include "QUICStreamManager.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "QUICStreamManager_quiche.h" #else #include "QUICStreamManager_native.h" @@ -43,7 +43,7 @@ #include "QUICPadder.h" #include "QUICHandshakeProtocol.h" #include "QUICStreamAdapter.h" -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #include "QUICStream_quiche.h" #else #include "QUICStream_native.h" @@ -255,7 +255,7 @@ class MockQUICStreamManager : public QUICStreamManagerImpl MockQUICStreamManager(QUICContext *context) : QUICStreamManagerImpl(context, nullptr) {} // Override -#ifndef HAVE_QUICHE_H +#if TS_HAS_QUICHE == 0 virtual QUICConnectionErrorUPtr handle_frame(QUICEncryptionLevel level, const QUICFrame &f) override { @@ -664,7 +664,7 @@ class MockQUICContext : public QUICContext { return _config; } -#ifndef HAVE_QUICHE_H +#if TS_HAS_QUICHE == 0 virtual QUICRTTProvider * rtt_provider() const override { diff --git a/iocore/net/quic/QUICContext.cc b/iocore/net/quic/QUICContext.cc index 7de91eab91d..18b573c9f7e 100644 --- a/iocore/net/quic/QUICContext.cc +++ b/iocore/net/quic/QUICContext.cc @@ -94,7 +94,7 @@ class QUICLDConfigQCP : public QUICLDConfig const QUICConfigParams *_params; }; -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE QUICContext::QUICContext(QUICConnectionInfoProvider *info) : _connection_info(info) {} #else QUICContext::QUICContext(QUICRTTProvider *rtt, QUICConnectionInfoProvider *info, QUICPacketProtectionKeyInfoProvider *key_info, @@ -121,7 +121,7 @@ QUICContext::config() const return _config; } -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #else QUICPacketProtectionKeyInfoProvider * QUICContext::key_info() const diff --git a/iocore/net/quic/QUICContext.h b/iocore/net/quic/QUICContext.h index 81eb761dae0..5a0de04e123 100644 --- a/iocore/net/quic/QUICContext.h +++ b/iocore/net/quic/QUICContext.h @@ -72,7 +72,7 @@ class QUICCallback class QUICContext { public: -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE QUICContext(QUICConnectionInfoProvider *info); #else QUICContext(QUICRTTProvider *rtt, QUICConnectionInfoProvider *info, QUICPacketProtectionKeyInfoProvider *key_info, @@ -82,7 +82,7 @@ class QUICContext virtual ~QUICContext(){}; virtual QUICConnectionInfoProvider *connection_info() const; virtual QUICConfig::scoped_config config() const; -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #else virtual QUICLDConfig &ld_config() const; virtual QUICPacketProtectionKeyInfoProvider *key_info() const; @@ -191,7 +191,7 @@ class QUICContext private: QUICConfig::scoped_config _config; QUICConnectionInfoProvider *_connection_info = nullptr; -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #else QUICPacketProtectionKeyInfoProvider *_key_info = nullptr; QUICRTTProvider *_rtt_provider = nullptr; diff --git a/iocore/net/quic/QUICGlobals.cc b/iocore/net/quic/QUICGlobals.cc index 3cb4ea594bf..ceb97cc7407 100644 --- a/iocore/net/quic/QUICGlobals.cc +++ b/iocore/net/quic/QUICGlobals.cc @@ -53,7 +53,7 @@ QUIC::init() int QUIC::ssl_client_new_session(SSL *ssl, SSL_SESSION *session) { -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE #else QUICTLS *qtls = static_cast(SSL_get_ex_data(ssl, QUIC::ssl_quic_tls_index)); const char *session_file = qtls->session_file(); diff --git a/proxy/http3/test/test_QPACK.cc b/proxy/http3/test/test_QPACK.cc index 6de8e189cd8..23d55caf28c 100644 --- a/proxy/http3/test/test_QPACK.cc +++ b/proxy/http3/test/test_QPACK.cc @@ -65,7 +65,7 @@ class QUICApplicationDriver }; // TODO: QUICUnidirectionalStream should be used if there -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE class TestQUICStream : public QUICStreamImpl #else class TestQUICStream : public QUICBidirectionalStream @@ -73,7 +73,7 @@ class TestQUICStream : public QUICBidirectionalStream { public: TestQUICStream(QUICStreamId sid) -#if HAVE_QUICHE_H +#if TS_HAS_QUICHE : QUICStreamImpl(new MockQUICConnectionInfoProvider(), sid) #else : QUICBidirectionalStream(new MockQUICRTTProvider(), new MockQUICConnectionInfoProvider(), sid, 65536, 65536)