summaryrefslogtreecommitdiffstats
path: root/src/plugins/tlsopenssl/tls_openssl.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-21 18:26:30 -0700
committerDave Barach <openvpp@barachs.net>2021-05-22 16:45:00 +0000
commitaf073546e1bf130089a58d9cdb8ca1da3492c933 (patch)
treefcb291fc6d97f38c80d11875a9a9b8b89014827d /src/plugins/tlsopenssl/tls_openssl.c
parent0f27339eaa6410ef6d993686825e73393b2a3ecb (diff)
tls: prealloc chunks for dtls dgram enq
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib25598f72f6539c07de1acee1e6049ecd28f35cc
Diffstat (limited to 'src/plugins/tlsopenssl/tls_openssl.c')
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 7a840f11b4a..496d777d3b3 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -422,10 +422,10 @@ openssl_ctx_write_dtls (tls_ctx_t *ctx, session_t *app_session,
{
openssl_main_t *om = &openssl_main;
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
+ u32 read = 0, to_deq, dgram_sz, enq_max;
session_dgram_pre_hdr_t hdr;
session_t *us;
int wrote, rv;
- u32 read = 0, to_deq, dgram_sz;
u8 *buf;
us = session_get_from_handle (ctx->tls_session_handle);
@@ -440,7 +440,9 @@ openssl_ctx_write_dtls (tls_ctx_t *ctx, session_t *app_session,
ASSERT (to_deq >= hdr.data_length + SESSION_CONN_HDR_LEN);
dgram_sz = hdr.data_length + SESSION_CONN_HDR_LEN;
- if (svm_fifo_max_enqueue_prod (us->tx_fifo) < dgram_sz + TLSO_CTRL_BYTES)
+ enq_max = dgram_sz + TLSO_CTRL_BYTES;
+ if (svm_fifo_max_enqueue_prod (us->tx_fifo) < enq_max ||
+ svm_fifo_provision_chunks (us->tx_fifo, 0, 0, enq_max))
{
svm_fifo_add_want_deq_ntf (us->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
transport_connection_deschedule (&ctx->connection);