diff options
author | Florin Coras <fcoras@cisco.com> | 2024-01-31 13:45:39 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-01-31 22:01:57 +0000 |
commit | 4a98b9360e2552340a0953a4bed6aed95c29e3df (patch) | |
tree | 75b912a01f6eb80d106e5f18aded72ca1129c2f3 /src/plugins | |
parent | 83ad79d69a09f504ba6ce3325fc165648eb55daa (diff) |
tls: convert ctx fields to connection flags
Type: refactor
Change-Id: I527bbc1cf2e7b6d06fd0c88b7563fb59ed28bc40
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/tlsopenssl/tls_async.c | 2 | ||||
-rw-r--r-- | src/plugins/tlsopenssl/tls_openssl.c | 20 | ||||
-rw-r--r-- | src/plugins/tlspicotls/tls_picotls.c | 6 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/plugins/tlsopenssl/tls_async.c b/src/plugins/tlsopenssl/tls_async.c index 89b4f77e331..bea9b892fa2 100644 --- a/src/plugins/tlsopenssl/tls_async.c +++ b/src/plugins/tlsopenssl/tls_async.c @@ -437,7 +437,7 @@ tls_async_do_job (int eidx, u32 thread_index) if (ctx) { - ctx->resume = 1; + ctx->flags |= TLS_CONN_F_RESUME; session_send_rpc_evt_to_thread (thread_index, event_handler, event); } return 1; diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c index e63413a3904..ee425362fd5 100644 --- a/src/plugins/tlsopenssl/tls_openssl.c +++ b/src/plugins/tlsopenssl/tls_openssl.c @@ -65,9 +65,10 @@ openssl_ctx_free (tls_ctx_t * ctx) openssl_ctx_t *oc = (openssl_ctx_t *) ctx; /* Cleanup ssl ctx unless migrated */ - if (!ctx->is_migrated) + if (!(ctx->flags & TLS_CONN_F_MIGRATED)) { - if (SSL_is_init_finished (oc->ssl) && !ctx->is_passive_close) + if (SSL_is_init_finished (oc->ssl) && + !(ctx->flags & TLS_CONN_F_PASSIVE_CLOSE)) SSL_shutdown (oc->ssl); SSL_free (oc->ssl); @@ -277,7 +278,7 @@ openssl_handle_handshake_failure (tls_ctx_t * ctx) ctx->c_s_index = SESSION_INVALID_INDEX; tls_disconnect_transport (ctx); } - ctx->no_app_session = 1; + ctx->flags |= TLS_CONN_F_NO_APP_SESSION; } else { @@ -297,9 +298,9 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, session_t * tls_session) while (SSL_in_init (oc->ssl)) { - if (ctx->resume) + if (ctx->flags & TLS_CONN_F_RESUME) { - ctx->resume = 0; + ctx->flags &= ~TLS_CONN_F_RESUME; } else if (!svm_fifo_max_dequeue_cons (tls_session->rx_fifo)) break; @@ -364,7 +365,7 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, session_t * tls_session) else { /* Need to check transport status */ - if (ctx->is_passive_close) + if (ctx->flags & TLS_CONN_F_PASSIVE_CLOSE) { openssl_handle_handshake_failure (ctx); return -1; @@ -441,7 +442,8 @@ openssl_ctx_write_tls (tls_ctx_t *ctx, session_t *app_session, check_tls_fifo: - if (PREDICT_FALSE (ctx->app_closed && BIO_ctrl_pending (oc->rbio) <= 0)) + if (PREDICT_FALSE ((ctx->flags & TLS_CONN_F_APP_CLOSED) && + BIO_ctrl_pending (oc->rbio) <= 0)) openssl_confirm_app_close (ctx); /* Deschedule and wait for deq notification if fifo is almost full */ @@ -513,7 +515,7 @@ done: if (read) tls_add_vpp_q_tx_evt (us); - if (PREDICT_FALSE (ctx->app_closed && + if (PREDICT_FALSE ((ctx->flags & TLS_CONN_F_APP_CLOSED) && !svm_fifo_max_enqueue_prod (us->rx_fifo))) openssl_confirm_app_close (ctx); @@ -1070,7 +1072,7 @@ openssl_app_close (tls_ctx_t * ctx) && !svm_fifo_max_dequeue_cons (app_session->tx_fifo)) openssl_confirm_app_close (ctx); else - ctx->app_closed = 1; + ctx->flags |= TLS_CONN_F_APP_CLOSED; return 0; } diff --git a/src/plugins/tlspicotls/tls_picotls.c b/src/plugins/tlspicotls/tls_picotls.c index 4c19084fea3..f6b267f0901 100644 --- a/src/plugins/tlspicotls/tls_picotls.c +++ b/src/plugins/tlspicotls/tls_picotls.c @@ -180,7 +180,7 @@ static void picotls_handle_handshake_failure (tls_ctx_t * ctx) { session_free (session_get (ctx->c_s_index, ctx->c_thread_index)); - ctx->no_app_session = 1; + ctx->flags |= TLS_CONN_F_NO_APP_SESSION; ctx->c_s_index = SESSION_INVALID_INDEX; tls_disconnect_transport (ctx); } @@ -213,7 +213,7 @@ picotls_app_close (tls_ctx_t * ctx) if (!svm_fifo_max_dequeue_cons (app_session->tx_fifo)) picotls_confirm_app_close (ctx); else - ctx->app_closed = 1; + ctx->flags |= TLS_CONN_F_APP_CLOSED; return 0; } @@ -625,7 +625,7 @@ picotls_ctx_write (tls_ctx_t *ctx, session_t *app_session, check_tls_fifo: - if (ctx->app_closed) + if (ctx->flags & TLS_CONN_F_APP_CLOSED) picotls_app_close (ctx); /* Deschedule and wait for deq notification if fifo is almost full */ |