Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/proxy/FetchSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class FetchSM : public Continuation
{
public:
FetchSM() {}

/** Indicate whether FetchSM dependencies have been initialized by ATS.
* @return True if FetchSM dependencies have been initialized, false otherwise.
*/
static bool is_initialized();

void
init_comm()
{
Expand Down
1 change: 1 addition & 0 deletions include/proxy/PluginHttpConnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@

#include "proxy/PluginVC.h"

bool PluginHttpConnectIsInitialized();
PluginVC *PluginHttpConnectInternal(TSHttpConnectOptions *options);
5 changes: 5 additions & 0 deletions src/iocore/cache/unit_tests/stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ TSIOBufferReaderConsume(TSIOBufferReader /* readerp ATS_UNUSED */, int64_t /* nb

#include "proxy/FetchSM.h"
ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
bool
FetchSM::is_initialized()
{
return true;
}
void
FetchSM::ext_launch()
{
Expand Down
10 changes: 9 additions & 1 deletion src/iocore/net/OCSPStapling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1284,13 +1284,19 @@ stapling_refresh_response(certinfo *cinf, TS_OCSP_RESPONSE **prsp)
return rv;
}

void
OCSPStatus
ocsp_update()
{
if (!FetchSM::is_initialized()) {
Dbg(dbg_ctl_ssl_ocsp, "FetchSM is not yet initialized. Skipping OCSP update.");
return OCSPStatus::OCSP_FETCHSM_NOT_INITIALIZED;
}
shared_SSL_CTX ctx;
TS_OCSP_RESPONSE *resp = nullptr;
time_t current_time;

Note("OCSP refresh started");

SSLCertificateConfig::scoped_config certLookup;

Dbg(dbg_ctl_ssl_ocsp, "updating OCSP data");
Expand Down Expand Up @@ -1332,6 +1338,8 @@ ocsp_update()
}
}
}
Note("OCSP refresh finished");
return OCSPStatus::OCSP_OK;
}

// RFC 6066 Section-8: Certificate Status Request
Expand Down
7 changes: 6 additions & 1 deletion src/iocore/net/P_OCSPStapling.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

void ssl_stapling_ex_init();
bool ssl_stapling_init_cert(SSL_CTX *ctx, X509 *cert, const char *certname, const char *rsp_file);
void ocsp_update();

enum class OCSPStatus {
OCSP_OK,
OCSP_FETCHSM_NOT_INITIALIZED,
};
OCSPStatus ocsp_update();

int ssl_callback_ocsp_stapling(SSL *, void *);
8 changes: 5 additions & 3 deletions src/iocore/net/SSLNetProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ struct OCSPContinuation : public Continuation {
int
mainEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
{
Note("OCSP refresh started");
ocsp_update();
Note("OCSP refresh finished");
if (ocsp_update() == OCSPStatus::OCSP_FETCHSM_NOT_INITIALIZED) {
Note("Delaying OCSP fetching until FetchSM is initialized.");
this_ethread()->schedule_in(this, HRTIME_SECONDS(1));
return EVENT_CONT;
}
return EVENT_CONT;
}

Expand Down
5 changes: 5 additions & 0 deletions src/iocore/net/libinknet_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ AppVersionInfo appVersionInfo;

#include "proxy/FetchSM.h"
ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
bool
FetchSM::is_initialized()
{
return true;
}
void
FetchSM::ext_launch()
{
Expand Down
6 changes: 6 additions & 0 deletions src/proxy/FetchSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ DbgCtl dbg_ctl{DEBUG_TAG};

} // end anonymous namespace

bool
FetchSM::is_initialized()
{
return PluginHttpConnectIsInitialized();
}

void
FetchSM::cleanUp()
{
Expand Down
6 changes: 6 additions & 0 deletions src/proxy/PluginHttpConnect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

extern HttpSessionAccept *plugin_http_accept;

bool
PluginHttpConnectIsInitialized()
{
return plugin_http_accept != nullptr;
}

PluginVC *
PluginHttpConnectInternal(TSHttpConnectOptions *options)
{
Expand Down
5 changes: 5 additions & 0 deletions src/traffic_quic/traffic_quic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ PreWarmManager prewarmManager;

#include "proxy/FetchSM.h"
ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
bool
FetchSM::is_initialized()
{
return true;
}
void
FetchSM::ext_launch()
{
Expand Down