clib_memset (ctx, 0, sizeof (quic_ctx_t));
ctx->c_thread_index = thread_index;
+ ctx->timer_handle = QUIC_TIMER_HANDLE_INVALID;
QUIC_DBG (3, "Allocated quic_ctx %u on thread %u",
ctx - qm->ctx_pool[thread_index], thread_index);
return ctx - qm->ctx_pool[thread_index];
{
QUIC_DBG (2, "Free ctx %u %x", ctx->c_thread_index, ctx->c_c_index);
u32 thread_index = ctx->c_thread_index;
+ ASSERT (ctx->timer_handle == QUIC_TIMER_HANDLE_INVALID);
if (CLIB_DEBUG)
clib_memset (ctx, 0xfb, sizeof (*ctx));
pool_put (quic_main.ctx_pool[thread_index], ctx);
clib_warning ("Event enqueue errored %d", rv);
}
+static inline void
+quic_stop_ctx_timer (quic_ctx_t * ctx)
+{
+ tw_timer_wheel_1t_3w_1024sl_ov_t *tw;
+ if (ctx->timer_handle == QUIC_TIMER_HANDLE_INVALID)
+ return;
+ tw = &quic_main.wrk_ctx[ctx->c_thread_index].timer_wheel;
+ tw_timer_stop_1t_3w_1024sl_ov (tw, ctx->timer_handle);
+ ctx->timer_handle = QUIC_TIMER_HANDLE_INVALID;
+ QUIC_DBG (4, "Stopping timer for ctx %u", ctx->c_c_index);
+}
+
/* QUIC protocol actions */
static void
static void
quic_connection_delete (quic_ctx_t * ctx)
{
- tw_timer_wheel_1t_3w_1024sl_ov_t *tw;
clib_bihash_kv_16_8_t kv;
quicly_conn_t *conn;
QUIC_DBG (2, "Deleting connection %u", ctx->c_c_index);
ASSERT (!quic_ctx_is_stream (ctx));
-
- /* Stop the timer */
- if (ctx->timer_handle != QUIC_TIMER_HANDLE_INVALID)
- {
- tw = &quic_main.wrk_ctx[ctx->c_thread_index].timer_wheel;
- tw_timer_stop_1t_3w_1024sl_ov (tw, ctx->timer_handle);
- }
+ quic_stop_ctx_timer (ctx);
/* Delete the connection from the connection map */
conn = ctx->conn;
if (ctx->conn)
quicly_free (ctx->conn);
ctx->conn = NULL;
-
session_transport_delete_notify (&ctx->connection);
- quic_ctx_free (ctx);
}
void
vlib_node_increment_counter (vm, quic_input_node.index, evt, val);
}
-
-
/**
* Called when quicly return an error
* This function interacts tightly with quic_proto_on_close
break;
case QUIC_CONN_STATE_PASSIVE_CLOSING_APP_CLOSED:
/* App already confirmed close, we can delete the connection */
- session_transport_delete_notify (&ctx->connection);
quic_connection_delete (ctx);
break;
case QUIC_CONN_STATE_PASSIVE_CLOSING_QUIC_CLOSED:
QUIC_DBG (0, "BUG");
break;
case QUIC_CONN_STATE_ACTIVE_CLOSING:
- session_transport_delete_notify (&ctx->connection);
quic_connection_delete (ctx);
break;
default:
max_enqueue = svm_fifo_max_enqueue (f);
if (max_enqueue < SESSION_CONN_HDR_LEN + len)
{
- QUIC_DBG (1, "Too much data to send, max_enqueue %u, len %u",
+ QUIC_ERR ("Too much data to send, max_enqueue %u, len %u",
max_enqueue, len + SESSION_CONN_HDR_LEN);
return QUIC_ERROR_FULL_FIFO;
}
ret = svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr);
if (ret != sizeof (hdr))
{
- QUIC_DBG (1, "Not enough space to enqueue header");
+ QUIC_ERR ("Not enough space to enqueue header");
return QUIC_ERROR_FULL_FIFO;
}
ret = svm_fifo_enqueue (f, len, packet->data.base);
if (ret != len)
{
- QUIC_DBG (1, "Not enough space to enqueue payload");
+ QUIC_ERR ("Not enough space to enqueue payload");
return QUIC_ERROR_FULL_FIFO;
}
app_worker_t *app_wrk;
svm_fifo_t *f;
quic_stream_data_t *stream_data;
- int rlen;
+ int rlen, rv;
stream_data = (quic_stream_data_t *) stream->data;
sctx = quic_ctx_get (stream_data->ctx_id, stream_data->thread_index);
max_enq = svm_fifo_max_enqueue_prod (f);
QUIC_DBG (3, "Enqueuing %u at off %u in %u space", len, off, max_enq);
- if (off - stream_data->app_rx_data_len + len > max_enq)
+ /* Handle duplicate packet/chunk from quicly */
+ if (off < stream_data->app_rx_data_len)
+ {
+ QUIC_DBG (3, "Session [idx %u, app_wrk %u, thread %u, rx-fifo 0x%llx]: "
+ "DUPLICATE PACKET (max_enq %u, len %u, "
+ "app_rx_data_len %u, off %u, ToBeNQ %u)",
+ stream_session->session_index,
+ stream_session->app_wrk_index,
+ stream_session->thread_index, f,
+ max_enq, len, stream_data->app_rx_data_len, off,
+ off - stream_data->app_rx_data_len + len);
+ return 0;
+ }
+ if (PREDICT_FALSE ((off - stream_data->app_rx_data_len + len) > max_enq))
{
- QUIC_DBG (1, "Error RX fifo is full");
+ QUIC_ERR ("Session [idx %u, app_wrk %u, thread %u, rx-fifo 0x%llx]: "
+ "RX FIFO IS FULL (max_enq %u, len %u, "
+ "app_rx_data_len %u, off %u, ToBeNQ %u)",
+ stream_session->session_index,
+ stream_session->app_wrk_index,
+ stream_session->thread_index, f,
+ max_enq, len, stream_data->app_rx_data_len, off,
+ off - stream_data->app_rx_data_len + len);
return 1;
}
if (off == stream_data->app_rx_data_len)
{
/* Streams live on the same thread so (f, stream_data) should stay consistent */
rlen = svm_fifo_enqueue (f, len, (u8 *) src);
+ QUIC_DBG (3, "Session [idx %u, app_wrk %u, ti %u, rx-fifo 0x%llx]: "
+ "Enqueuing %u (rlen %u) at off %u in %u space, ",
+ stream_session->session_index,
+ stream_session->app_wrk_index,
+ stream_session->thread_index, f, len, rlen, off, max_enq);
stream_data->app_rx_data_len += rlen;
ASSERT (rlen >= len);
app_wrk = app_worker_get_if_valid (stream_session->app_wrk_index);
if (PREDICT_TRUE (app_wrk != 0))
- app_worker_lock_and_send_event (app_wrk, stream_session,
- SESSION_IO_EVT_RX);
+ {
+ rv = app_worker_lock_and_send_event (app_wrk, stream_session,
+ SESSION_IO_EVT_RX);
+ if (rv)
+ QUIC_ERR ("Failed to ping app for RX");
+ }
quic_ack_rx_data (stream_session);
}
else
app_wrk = app_worker_get (stream_session->app_wrk_index);
if ((rv = app_worker_init_connected (app_wrk, stream_session)))
{
- QUIC_DBG (1, "failed to allocate fifos");
+ QUIC_ERR ("failed to allocate fifos");
session_free (stream_session);
quicly_reset_stream (stream, QUIC_APP_ALLOCATION_ERROR);
return 0; /* Frame is still valid */
if ((rv = app_worker_accept_notify (app_wrk, stream_session)))
{
- QUIC_DBG (1, "failed to notify accept worker app");
+ QUIC_ERR ("failed to notify accept worker app");
session_free_w_fifos (stream_session);
quicly_reset_stream (stream, QUIC_APP_ACCEPT_NOTIFY_ERROR);
return 0; /* Frame is still valid */
tw_timer_wheel_1t_3w_1024sl_ov_t *tw;
int64_t next_timeout, next_interval;
session_t *quic_session;
+ int rv;
/* This timeout is in ms which is the unit of our timer */
next_timeout = quicly_get_first_timeout (ctx->conn);
{
quic_session = session_get (ctx->c_s_index, ctx->c_thread_index);
if (svm_fifo_set_event (quic_session->tx_fifo))
- session_send_io_evt_to_thread_custom (quic_session,
- quic_session->thread_index,
- SESSION_IO_EVT_BUILTIN_TX);
+ {
+ rv = session_send_io_evt_to_thread_custom (quic_session,
+ quic_session->thread_index,
+ SESSION_IO_EVT_BUILTIN_TX);
+ if (PREDICT_FALSE (rv))
+ QUIC_ERR ("Failed to enqueue builtin_tx %d", rv);
+ }
return;
}
}
{
if (next_timeout == INT64_MAX)
{
- tw_timer_stop_1t_3w_1024sl_ov (tw, ctx->timer_handle);
- ctx->timer_handle = QUIC_TIMER_HANDLE_INVALID;
- QUIC_DBG (4, "Stopping timer for ctx %u", ctx->c_c_index);
+ quic_stop_ctx_timer (ctx);
}
else
tw_timer_update_1t_3w_1024sl_ov (tw, ctx->timer_handle,
return 0;
}
-static void
-quic_store_quicly_ctx (application_t * app, u32 cert_key_index)
+static int
+quic_store_quicly_ctx (application_t * app, u32 ckpair_index,
+ u8 crypto_engine)
{
quic_main_t *qm = &quic_main;
quicly_context_t *quicly_ctx;
ptls_iovec_t key_vec;
app_cert_key_pair_t *ckpair;
+ u64 max_enq;
if (app->quicly_ctx)
- return;
+ return 0;
+
+ if (crypto_engine == CRYPTO_ENGINE_NONE)
+ {
+ QUIC_DBG (2, "No crypto engine specified, using %d", crypto_engine);
+ crypto_engine = qm->default_crypto_engine;
+ }
+ if (!clib_bitmap_get (qm->available_crypto_engines, crypto_engine))
+ {
+ QUIC_ERR ("Quic does not support crypto engine %d", crypto_engine);
+ return VNET_API_ERROR_MISSING_CERT_KEY;
+ }
quicly_ctx_data_t *quicly_ctx_data =
clib_mem_alloc (sizeof (quicly_ctx_data_t));
ptls_ctx->random_bytes = ptls_openssl_random_bytes;
ptls_ctx->get_time = &ptls_get_time;
ptls_ctx->key_exchanges = ptls_openssl_key_exchanges;
- ptls_ctx->cipher_suites = qm->quic_ciphers[qm->default_cipher];
+ ptls_ctx->cipher_suites = qm->quic_ciphers[crypto_engine];
ptls_ctx->certificates.list = NULL;
ptls_ctx->certificates.count = 0;
ptls_ctx->esni = NULL;
quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;
quicly_ctx->transport_params.max_streams_bidi = (uint64_t) 1 << 60;
- quicly_ctx->transport_params.max_stream_data.bidi_local = (qm->udp_fifo_size - 1); /* max_enq is SIZE - 1 */
- quicly_ctx->transport_params.max_stream_data.bidi_remote = (qm->udp_fifo_size - 1); /* max_enq is SIZE - 1 */
+
+ /* max_enq is FIFO_SIZE - 1 */
+ max_enq = app->sm_properties.rx_fifo_size - 1;
+ quicly_ctx->transport_params.max_stream_data.bidi_local = max_enq;
+ max_enq = app->sm_properties.tx_fifo_size - 1;
+ quicly_ctx->transport_params.max_stream_data.bidi_remote = max_enq;
quicly_ctx->transport_params.max_stream_data.uni = QUIC_INT_MAX;
quicly_ctx->tls->random_bytes (quicly_ctx_data->cid_key, 16);
&ptls_openssl_aes128ecb,
&ptls_openssl_sha256, key_vec);
- ckpair = app_cert_key_pair_get_if_valid (cert_key_index);
- if (ckpair && ckpair->key != NULL && ckpair->cert != NULL)
+ ckpair = app_cert_key_pair_get_if_valid (ckpair_index);
+ if (!ckpair || !ckpair->key || !ckpair->cert)
{
- if (load_bio_private_key (quicly_ctx->tls, (char *) ckpair->key))
- {
- QUIC_DBG (1, "failed to read private key from app configuration\n");
- }
- if (load_bio_certificate_chain (quicly_ctx->tls, (char *) ckpair->cert))
- {
- QUIC_DBG (1, "failed to load certificate\n");
- }
+ QUIC_ERR ("Wrong ckpair id %d\n", ckpair_index);
+ goto error;
}
+ if (load_bio_private_key (quicly_ctx->tls, (char *) ckpair->key))
+ {
+ QUIC_ERR ("failed to read private key from app configuration\n");
+ goto error;
+ }
+ if (load_bio_certificate_chain (quicly_ctx->tls, (char *) ckpair->cert))
+ {
+ QUIC_ERR ("failed to load certificate\n");
+ goto error;
+ }
+ return 0;
+
+error:
+ clib_mem_free (quicly_ctx_data);
+ return VNET_API_ERROR_MISSING_CERT_KEY;
}
/* Transport proto functions */
if (session_type_transport_proto (quic_session->session_type) !=
TRANSPORT_PROTO_QUIC)
{
- QUIC_DBG (1, "received incompatible session");
+ QUIC_ERR ("received incompatible session");
return -1;
}
app_wrk = app_worker_get_if_valid (quic_session->app_wrk_index);
if (!app_wrk)
{
- QUIC_DBG (1, "Invalid app worker :(");
+ QUIC_ERR ("Invalid app worker :(");
return -1;
}
quic_session->thread_index);
if (quic_ctx_is_stream (qctx))
{
- QUIC_DBG (1, "session is a stream");
+ QUIC_ERR ("session is a stream");
quic_ctx_free (sctx);
return -1;
}
if (app_worker_init_connected (app_wrk, stream_session))
{
- QUIC_DBG (1, "failed to app_worker_init_connected");
+ QUIC_ERR ("failed to app_worker_init_connected");
quicly_reset_stream (stream, QUIC_APP_ALLOCATION_ERROR);
session_free_w_fifos (stream_session);
quic_ctx_free (sctx);
stream_session->session_state = SESSION_STATE_READY;
if (app_worker_connect_notify (app_wrk, stream_session, opaque))
{
- QUIC_DBG (1, "failed to notify app");
+ QUIC_ERR ("failed to notify app");
quicly_reset_stream (stream, QUIC_APP_CONNECT_NOTIFY_ERROR);
session_free_w_fifos (stream_session);
quic_ctx_free (sctx);
ctx->parent_app_id = app_wrk->app_index;
cargs->sep_ext.ns_index = app->ns_index;
- quic_store_quicly_ctx (app, ctx->ckpair_index);
+ if ((error =
+ quic_store_quicly_ctx (app, sep->ckpair_index, sep->crypto_engine)))
+ return error;
/* Also store it in ctx for convenience
* Waiting for crypto_ctx logic */
ctx->quicly_ctx = (quicly_context_t *) app->quicly_ctx;
app = application_get (app_wrk->app_index);
QUIC_DBG (2, "Called quic_start_listen for app %d", app_wrk->app_index);
- quic_store_quicly_ctx (app, sep->ckpair_index);
+ if (quic_store_quicly_ctx (app, sep->ckpair_index, sep->crypto_engine))
+ return -1;
sep->transport_proto = TRANSPORT_PROTO_UDPC;
clib_memset (args, 0, sizeof (*args));
if (app_worker_init_connected (app_wrk, quic_session))
{
- QUIC_DBG (1, "failed to app_worker_init_connected");
+ QUIC_ERR ("failed to app_worker_init_connected");
quic_proto_on_close (ctx_id, thread_index);
return app_worker_connect_notify (app_wrk, NULL, ctx->client_opaque);
}
if ((rv = app_worker_connect_notify (app_wrk, quic_session,
ctx->client_opaque)))
{
- QUIC_DBG (1, "failed to notify app %d", rv);
+ QUIC_ERR ("failed to notify app %d", rv);
quic_proto_on_close (ctx_id, thread_index);
return -1;
}
static void
quic_transfer_connection (u32 ctx_index, u32 dest_thread)
{
- tw_timer_wheel_1t_3w_1024sl_ov_t *tw;
quic_ctx_t *ctx, *temp_ctx;
u32 thread_index = vlib_get_thread_index ();
clib_memcpy (temp_ctx, ctx, sizeof (quic_ctx_t));
- /* Remove from timer wheel and thread-local pool */
- if (ctx->timer_handle != QUIC_TIMER_HANDLE_INVALID)
- {
- tw = &quic_main.wrk_ctx[thread_index].timer_wheel;
- tw_timer_stop_1t_3w_1024sl_ov (tw, ctx->timer_handle);
- }
+ quic_stop_ctx_timer (ctx);
quic_ctx_free (ctx);
/* Send connection to destination thread */
clib_warning ("UDP session disconnected???");
}
+static void
+quic_udp_session_cleanup_callback (session_t * udp_session,
+ session_cleanup_ntf_t ntf)
+{
+ quic_ctx_t *ctx;
+
+ if (ntf != SESSION_CLEANUP_SESSION)
+ return;
+
+ ctx = quic_ctx_get (udp_session->opaque, udp_session->thread_index);
+ quic_stop_ctx_timer (ctx);
+ quic_ctx_free (ctx);
+}
+
static void
quic_udp_session_reset_callback (session_t * s)
{
u32 new_thread = session_thread_from_handle (new_sh);
quic_ctx_t *ctx;
- QUIC_DBG (1, "Session %x migrated to %lx", s->session_index, new_sh);
+ QUIC_ERR ("Session %x migrated to %lx", s->session_index, new_sh);
ASSERT (vlib_get_thread_index () == s->thread_index);
ctx = quic_ctx_get (s->opaque, s->thread_index);
ASSERT (ctx->udp_session_handle == session_handle (s));
{
/* New UDP connection, try to accept it */
u32 ctx_index;
- u32 *pool_index;
quic_ctx_t *ctx, *lctx;
session_t *udp_listen_session;
u32 thread_index = vlib_get_thread_index ();
udp_session->opaque = ctx_index;
- /* Put this ctx in the "opening" pool */
- pool_get (quic_main.wrk_ctx[ctx->c_thread_index].opening_ctx_pool,
- pool_index);
- *pool_index = ctx_index;
-
/* TODO timeout to delete these if they never connect */
return 0;
}
stream = ctx->stream;
if (!quicly_sendstate_is_open (&stream->sendstate))
{
- QUIC_DBG (1, "Warning: tried to send on closed stream");
+ QUIC_ERR ("Warning: tried to send on closed stream");
return -1;
}
/* new connection, accept and create context if packet is valid
* TODO: check if socket is actually listening? */
ctx = quic_ctx_get (ctx_index, thread_index);
+ if (ctx->c_s_index != QUIC_SESSION_INVALID)
+ {
+ QUIC_DBG (2, "already accepted ctx 0x%x", ctx_index);
+ return -1;
+ }
+
quicly_ctx = quic_get_quicly_ctx_from_ctx (ctx);
if ((rv = quicly_accept (&conn, quicly_ctx, NULL, sa,
&packet, NULL, &quic_main.next_cid, NULL)))
{
/* Invalid packet, pass */
assert (conn == NULL);
- QUIC_DBG (1, "Accept failed with %d", rv);
+ QUIC_ERR ("Accept failed with %U", quic_format_err, rv);
/* TODO: cleanup created quic ctx and UDP session */
return 0;
}
* but we still need fifos for the events? */
if ((rv = app_worker_init_accepted (quic_session)))
{
- QUIC_DBG (1, "failed to allocate fifos");
+ QUIC_ERR ("failed to allocate fifos");
session_free (quic_session);
return rv;
}
app_wrk = app_worker_get (quic_session->app_wrk_index);
if ((rv = app_worker_accept_notify (app_wrk, quic_session)))
{
- QUIC_DBG (1, "failed to notify accept worker app");
+ QUIC_ERR ("failed to notify accept worker app");
return rv;
}
size_t plen;
struct sockaddr_in6 sa6;
struct sockaddr *sa = (struct sockaddr *) &sa6;
+ session_t *udp_session;
socklen_t salen;
u32 full_len, ret;
int err, rv = 0;
packet_ctx->thread_index = UINT32_MAX;
packet_ctx->ctx_index = UINT32_MAX;
u32 thread_index = vlib_get_thread_index ();
- u32 *opening_ctx_pool, *ctx_index_ptr;
u32 cur_deq = svm_fifo_max_dequeue (f) - *fifo_offset;
quicly_context_t *quicly_ctx;
if (cur_deq < SESSION_CONN_HDR_LEN)
{
- QUIC_DBG (1, "Not enough data for even a header in RX");
+ QUIC_ERR ("Not enough data for even a header in RX");
return 1;
}
ret = svm_fifo_peek (f, *fifo_offset, SESSION_CONN_HDR_LEN, (u8 *) & ph);
if (ret != SESSION_CONN_HDR_LEN)
{
- QUIC_DBG (1, "Not enough data for header in RX");
+ QUIC_ERR ("Not enough data for header in RX");
return 1;
}
ASSERT (ph.data_offset == 0);
full_len = ph.data_length + SESSION_CONN_HDR_LEN;
if (full_len > cur_deq)
{
- QUIC_DBG (1, "Not enough data in fifo RX");
+ QUIC_ERR ("Not enough data in fifo RX");
return 1;
}
ph.data_length, packet_ctx->data);
if (ret != ph.data_length)
{
- QUIC_DBG (1, "Not enough data peeked in RX");
+ QUIC_ERR ("Not enough data peeked in RX");
return 1;
}
ctx = quic_ctx_get (packet_ctx->ctx_index, thread_index);
rv = quicly_receive (ctx->conn, NULL, sa, &packet_ctx->packet);
if (rv)
- QUIC_DBG (1, "quicly_receive return error %d", rv);
+ QUIC_ERR ("quicly_receive errored %U", quic_format_err, rv);
}
else if (packet_ctx->ctx_index != UINT32_MAX)
{
*max_packet = packet_n + 1;
return 0;
}
- else if ((packet_ctx->packet.octets.base[0] & QUICLY_PACKET_TYPE_BITMASK) ==
- QUICLY_PACKET_TYPE_INITIAL)
+ else if (QUICLY_PACKET_IS_LONG_HEADER (packet_ctx->packet.octets.base[0]))
{
- /* Try to find matching "opening" ctx */
- opening_ctx_pool = quic_main.wrk_ctx[thread_index].opening_ctx_pool;
-
- /* *INDENT-OFF* */
- pool_foreach (ctx_index_ptr, opening_ctx_pool,
- ({
- ctx = quic_ctx_get (*ctx_index_ptr, thread_index);
- if (ctx->udp_session_handle == udp_session_handle)
- {
- /* Right ctx found, create conn & remove from pool */
- quic_accept_connection (*ctx_index_ptr, sa, salen, packet_ctx->packet);
- *max_packet = packet_n + 1;
- packet_ctx->thread_index = thread_index;
- packet_ctx->ctx_index = *ctx_index_ptr;
- pool_put (opening_ctx_pool, ctx_index_ptr);
- goto updateOffset;
- }
- }));
- /* *INDENT-ON* */
+ udp_session = session_get_from_handle (udp_session_handle);
+ if ((rv = quic_accept_connection (udp_session->opaque, sa,
+ salen, packet_ctx->packet)))
+ {
+ QUIC_ERR ("quic accept errored with %d", rv);
+ }
}
else
{
packet_ctx->packet);
}
-updateOffset:
*fifo_offset += SESSION_CONN_HDR_LEN + ph.data_length;
return 0;
}
.add_segment_callback = quic_add_segment_callback,
.del_segment_callback = quic_del_segment_callback,
.builtin_app_rx_callback = quic_udp_session_rx_callback,
+ .session_cleanup_callback = quic_udp_session_cleanup_callback,
};
static const transport_proto_vft_t quic_proto = {
{
quic_main_t *qm = &quic_main;
vec_validate (qm->quic_ciphers, type);
+ clib_bitmap_set (qm->available_crypto_engines, type, 1);
qm->quic_ciphers[type] = ciphers;
}
transport_register_protocol (TRANSPORT_PROTO_QUIC, &quic_proto,
FIB_PROTOCOL_IP6, ~0);
+ clib_bitmap_alloc (qm->available_crypto_engines,
+ app_crypto_engine_n_types ());
quic_register_cipher_suite (CRYPTO_ENGINE_VPP, quic_crypto_cipher_suites);
quic_register_cipher_suite (CRYPTO_ENGINE_PICOTLS,
ptls_openssl_cipher_suites);
- qm->default_cipher = CRYPTO_ENGINE_PICOTLS;
+ qm->default_crypto_engine = CRYPTO_ENGINE_PICOTLS;
vec_free (a->name);
return 0;
}
return clib_error_return (0, "unknown input '%U'",
format_unformat_error, input);
if (unformat (input, "vpp"))
- qm->default_cipher = CRYPTO_ENGINE_VPP;
+ qm->default_crypto_engine = CRYPTO_ENGINE_VPP;
else if (unformat (input, "picotls"))
- qm->default_cipher = CRYPTO_ENGINE_PICOTLS;
+ qm->default_crypto_engine = CRYPTO_ENGINE_PICOTLS;
else
return clib_error_return (0, "unknown input '%U'",
format_unformat_error, input);
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
+ quic_main_t *qm = &quic_main;
unformat_input_t _line_input, *line_input = &_line_input;
+ uword tmp;
+
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat
- (line_input, "%U", unformat_data_size, &quic_main.udp_fifo_size))
- quic_update_fifo_size ();
+ if (unformat (line_input, "%U", unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000ULL)
+ {
+ return clib_error_return
+ (0, "fifo-size %llu (0x%llx) too large", tmp, tmp);
+ }
+ qm->udp_fifo_size = tmp;
+ quic_update_fifo_size ();
+ }
else
return clib_error_return (0, "unknown input '%U'",
format_unformat_error, line_input);
return 0;
}
+static clib_error_t *
+quic_show_ctx_command_fn (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ quic_main_t *qm = &quic_main;
+ quic_ctx_t *ctx = NULL;
+ u32 num_workers = vlib_num_workers ();
+
+ for (int i = 0; i < num_workers + 1; i++)
+ {
+ /* *INDENT-OFF* */
+ pool_foreach (ctx, qm->ctx_pool[i],
+ ({
+ vlib_cli_output (vm, "%U", format_quic_ctx, ctx, 1);
+ }));
+ /* *INDENT-ON* */
+ }
+ return 0;
+}
+
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (quic_plugin_crypto_command, static) =
{
VLIB_CLI_COMMAND(quic_plugin_set_fifo_size_command, static)=
{
.path = "quic set fifo-size",
- .short_help = "quic set fifo-size N[Kb|Mb|GB] (default 64K)",
+ .short_help = "quic set fifo-size N[K|M|G] (default 64K)",
.function = quic_plugin_set_fifo_size_command_fn,
};
VLIB_CLI_COMMAND(quic_plugin_stats_command, static)=
.short_help = "show quic stats",
.function = quic_plugin_showstats_command_fn,
};
+VLIB_CLI_COMMAND(quic_show_ctx_command, static)=
+{
+ .path = "show quic ctx",
+ .short_help = "show quic ctx",
+ .function = quic_show_ctx_command_fn,
+};
VLIB_PLUGIN_REGISTER () =
{
.version = VPP_BUILD_VER,
static clib_error_t *
quic_config_fn (vlib_main_t * vm, unformat_input_t * input)
{
- quic_main.udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE;
- quic_main.udp_fifo_prealloc = 0;
+ quic_main_t *qm = &quic_main;
+ uword tmp;
+ qm->udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE;
+ qm->udp_fifo_prealloc = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat
- (input, "fifo-size %U", unformat_data_size,
- &quic_main.udp_fifo_size))
- ;
+ if (unformat (input, "fifo-size %U", unformat_memory_size, &tmp))
+ {
+ if (tmp >= 0x100000000ULL)
+ {
+ return clib_error_return
+ (0, "fifo-size %llu (0x%llx) too large", tmp, tmp);
+ }
+ qm->udp_fifo_size = tmp;
+ }
else
if (unformat
(input, "fifo-prealloc %u", &quic_main.udp_fifo_prealloc))