Compare commits

...

15 Commits

Author SHA1 Message Date
Andrew Yourtchenko
7c4027fa5e misc: VPP 23.10 Release Notes
Type: docs
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: Icd40064c06ccc53efba1cd9564613108b999b656
2023-10-20 11:24:41 +02:00
Florin Coras
fe95c23795 session: ignore app rx ntf if transport closed
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Id56a101a6350903b00f7c96705fb86039e70e12c
(cherry picked from commit a0b8c8fdf3fc555fc2ed7792d67bf3fb4fb99b9f)
2023-10-11 20:05:48 +00:00
Dave Wallace
015a6f7f17 vppinfra: fix coverity issue CID 323952
Type: fix
Fixes: 08600ccfa

Change-Id: I53ba0d96507b55ab7cd735073d6c4cf20a3cc948
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
(cherry picked from commit 05cc62dd504bbb0fb230fcf3786ed7f4d5be2364)
2023-10-11 03:13:11 +00:00
Florin Coras
471dc6b1e3 session: maintain old state on premature close
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I2ea821e0499a3874c4579f5480ea86f30ebe615f
(cherry picked from commit 84c9ee3d696ef5c1162530a30ba591b806a7e175)
2023-10-10 23:49:41 +00:00
Florin Coras
1ec3a70f66 session: propagate delayed rx evts after connect/accept
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I4a2e8f864df7269ec5a3c4fd4d8785a67b687d58
(cherry picked from commit 431b489c5a4f60a82781ace60d07471d003787af)
2023-10-09 23:39:49 +00:00
Florin Coras
9003233377 tls: propagate reads to app irrespective of state
Session input node handles rx notifications even if session not fully
accepted/connected

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I6560c45db8f8e0b7f0dc3bdd0939f13ca2f43f15
(cherry picked from commit aa7b88120ad83a29a05522bed4e5aa71524b8aba)
2023-10-09 21:46:16 +00:00
Florin Coras
3c06859f9f session: handle accept and connect errors
If builtin apps refuse connections, they should be cleaned up.

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I95ef22902ac3fe873e15e250aa5f03031c2dc0c4
(cherry picked from commit 9ffec14a2202e1268c4a2f189c39a90986090a25)
2023-10-09 21:42:49 +00:00
Florin Coras
4ba523740f tls: no read after app close
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I34f8ee2e36d07e8e55e21561528fc6b73feb852f
(cherry picked from commit 3843d0dd03a3ebbdb5d13b54e1b871a8ea72498c)
2023-10-09 21:41:12 +00:00
Florin Coras
05919da49d tls: report error if connected cannot be initialized
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I987ac6b461b473836917bce6ce0d4ac109cc8ddb
(cherry picked from commit a3d55df1e91a7df4ad4c0e1b639ba12a1ed04c79)
2023-10-09 21:40:38 +00:00
Damjan Marion
b53daca83f vppinfra: fix string termination in clib_file_get_resolved_basename
Type: fix
Fixes: 40f4810
Change-Id: Idf51462c8154663de23154f17a894b7245c9fbf0
Signed-off-by: Damjan Marion <damarion@cisco.com>
(cherry picked from commit 08600ccfa12f529d6ca7b852106227fc5f7addbf)
2023-10-09 21:38:26 +00:00
Florin Coras
15d0c7a3fb tls: limit openssl engine max read burst
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic7a8fd37d79fc9c09c8b1539d630f3b8983b8bb3
(cherry picked from commit c1b038001e1f18effb3c9ff5daa9e9cac1cd66e8)
2023-10-09 21:37:55 +00:00
Florin Coras
f9af6b32ef tls: init connection for prealloced app sessions
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Icd62dc110e3a73b24372f3a5162f8008b7edee9f
(cherry picked from commit a127d3c157cb6e7658451a877abbfe0dd16c982a)
2023-10-09 21:37:24 +00:00
Florin Coras
ee2e502736 tls: ignore tx events for not fully established sessions
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I401a116a1a46c0dc5d591115de5ff0eef2f6440b
2023-10-09 21:36:45 +00:00
Florin Coras
e7295fd974 tls: fix formatting of half open connections
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: If96dc748a716a261edfcb1020210bd73058e382f
2023-10-02 19:33:49 +00:00
Andrew Yourtchenko
14df6fc1ea misc: Initial changes for stable/2310 branch
Type: docs
Change-Id: I82d323c6e4585772e5c9a9f5b5bbb77b65c1da85
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2023-09-20 16:56:20 +02:00
9 changed files with 716 additions and 28 deletions

View File

@ -2,3 +2,4 @@
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/2310

View File

@ -6,6 +6,7 @@ Release notes
.. toctree::
:maxdepth: 2
v23.10
v23.06
v23.02
v22.10.1

File diff suppressed because it is too large Load Diff

View File

@ -163,7 +163,7 @@ openssl_lctx_get (u32 lctx_index)
return -1;
static int
openssl_read_from_ssl_into_fifo (svm_fifo_t * f, SSL * ssl)
openssl_read_from_ssl_into_fifo (svm_fifo_t *f, SSL *ssl, u32 max_len)
{
int read, rv, n_fs, i;
const int n_segs = 2;
@ -174,6 +174,7 @@ openssl_read_from_ssl_into_fifo (svm_fifo_t * f, SSL * ssl)
if (!max_enq)
return 0;
max_enq = clib_min (max_len, max_enq);
n_fs = svm_fifo_provision_chunks (f, fs, n_segs, max_enq);
if (n_fs < 0)
return 0;
@ -533,9 +534,10 @@ static inline int
openssl_ctx_read_tls (tls_ctx_t *ctx, session_t *tls_session)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
const u32 max_len = 128 << 10;
session_t *app_session;
int read;
svm_fifo_t *f;
int read;
if (PREDICT_FALSE (SSL_in_init (oc->ssl)))
{
@ -549,7 +551,7 @@ openssl_ctx_read_tls (tls_ctx_t *ctx, session_t *tls_session)
app_session = session_get_from_handle (ctx->app_session_handle);
f = app_session->rx_fifo;
read = openssl_read_from_ssl_into_fifo (f, oc->ssl);
read = openssl_read_from_ssl_into_fifo (f, oc->ssl, max_len);
/* Unrecoverable protocol error. Reset connection */
if (PREDICT_FALSE (read < 0))
@ -558,8 +560,7 @@ openssl_ctx_read_tls (tls_ctx_t *ctx, session_t *tls_session)
return 0;
}
/* If handshake just completed, session may still be in accepting state */
if (read && app_session->session_state >= SESSION_STATE_READY)
if (read)
tls_notify_app_enqueue (ctx, app_session);
if ((SSL_pending (oc->ssl) > 0) ||

View File

@ -445,7 +445,7 @@ picotls_ctx_read (tls_ctx_t *ctx, session_t *tcp_session)
app_session = session_get_from_handle (ctx->app_session_handle);
wrote = ptls_tcp_to_app_write (ptls_ctx, app_session->rx_fifo, tcp_rx_fifo);
if (wrote && app_session->session_state >= SESSION_STATE_READY)
if (wrote)
tls_notify_app_enqueue (ctx, app_session);
if (ptls_ctx->read_buffer_offset || svm_fifo_max_dequeue (tcp_rx_fifo))

View File

@ -77,10 +77,12 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
{
application_t *app = application_get (app_wrk->app_index);
svm_msg_q_t *mq = app_wrk->event_queue;
u8 ring_index, mq_is_cong;
session_state_t old_state;
session_event_t *evt;
u32 n_evts = 128, i;
u8 ring_index, mq_is_cong;
session_t *s;
int rv;
n_evts = clib_min (n_evts, clib_fifo_elts (app_wrk->wrk_evts[thread_index]));
@ -111,16 +113,18 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
{
case SESSION_IO_EVT_RX:
s = session_get (evt->session_index, thread_index);
s->flags &= ~SESSION_F_RX_EVT;
/* Application didn't confirm accept yet */
if (PREDICT_FALSE (s->session_state == SESSION_STATE_ACCEPTING))
if (PREDICT_FALSE (s->session_state == SESSION_STATE_ACCEPTING ||
s->session_state == SESSION_STATE_CONNECTING))
break;
s->flags &= ~SESSION_F_RX_EVT;
app->cb_fns.builtin_app_rx_callback (s);
break;
/* Handle sessions that might not be on current thread */
case SESSION_IO_EVT_BUILTIN_RX:
s = session_get_from_handle_if_valid (evt->session_handle);
if (!s || s->session_state == SESSION_STATE_ACCEPTING)
if (!s || s->session_state == SESSION_STATE_ACCEPTING ||
s->session_state == SESSION_STATE_CONNECTING)
break;
s->flags &= ~SESSION_F_RX_EVT;
app->cb_fns.builtin_app_rx_callback (s);
@ -145,16 +149,56 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
break;
case SESSION_CTRL_EVT_ACCEPTED:
s = session_get (evt->session_index, thread_index);
app->cb_fns.session_accept_callback (s);
old_state = s->session_state;
if (app->cb_fns.session_accept_callback (s))
{
session_close (s);
s->app_wrk_index = SESSION_INVALID_INDEX;
break;
}
if (is_builtin)
{
if (s->flags & SESSION_F_RX_EVT)
{
s->flags &= ~SESSION_F_RX_EVT;
app->cb_fns.builtin_app_rx_callback (s);
}
if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
{
session_set_state (s, old_state);
app_worker_close_notify (app_wrk, s);
}
}
break;
case SESSION_CTRL_EVT_CONNECTED:
if (!(evt->as_u64[1] & 0xffffffff))
s = session_get (evt->session_index, thread_index);
{
s = session_get (evt->session_index, thread_index);
old_state = s->session_state;
}
else
s = 0;
app->cb_fns.session_connected_callback (app_wrk->wrk_index,
evt->as_u64[1] >> 32, s,
evt->as_u64[1] & 0xffffffff);
rv = app->cb_fns.session_connected_callback (
app_wrk->wrk_index, evt->as_u64[1] >> 32, s,
evt->as_u64[1] & 0xffffffff);
if (!s)
break;
if (rv)
{
session_close (s);
s->app_wrk_index = SESSION_INVALID_INDEX;
break;
}
if (s->flags & SESSION_F_RX_EVT)
{
s->flags &= ~SESSION_F_RX_EVT;
app->cb_fns.builtin_app_rx_callback (s);
}
if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
{
session_set_state (s, old_state);
app_worker_close_notify (app_wrk, s);
}
break;
case SESSION_CTRL_EVT_DISCONNECTED:
s = session_get (evt->session_index, thread_index);

View File

@ -456,6 +456,7 @@ session_mq_accepted_reply_handler (session_worker_t *wrk,
a->app_index = mp->context;
a->handle = mp->handle;
vnet_disconnect_session (a);
s->app_wrk_index = SESSION_INVALID_INDEX;
return;
}
@ -1784,7 +1785,7 @@ session_event_dispatch_io (session_worker_t * wrk, vlib_node_runtime_t * node,
break;
case SESSION_IO_EVT_RX:
s = session_event_get_session (wrk, e);
if (!s)
if (!s || s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
break;
transport_app_rx_evt (session_get_transport_proto (s),
s->connection_index, s->thread_index);

View File

@ -227,7 +227,12 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
app_session->opaque = ctx->parent_app_api_context;
if ((err = app_worker_init_connected (app_wrk, app_session)))
goto failed;
{
app_worker_connect_notify (app_wrk, 0, err, ctx->parent_app_api_context);
ctx->no_app_session = 1;
session_free (app_session);
return -1;
}
app_session->session_state = SESSION_STATE_READY;
parent_app_api_ctx = ctx->parent_app_api_context;
@ -244,9 +249,6 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
return 0;
failed:
ctx->no_app_session = 1;
tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ());
send_reply:
return app_worker_connect_notify (app_wrk, 0, err,
ctx->parent_app_api_context);
@ -486,6 +488,9 @@ tls_session_accept_callback (session_t * tls_session)
* on tls_session rx and potentially invalidating the session pool */
app_session = session_alloc (ctx->c_thread_index);
app_session->session_state = SESSION_STATE_CREATED;
app_session->session_type =
session_type_from_proto_and_ip (TRANSPORT_PROTO_TLS, ctx->tcp_is_ip4);
app_session->connection_index = ctx->tls_ctx_handle;
ctx->c_s_index = app_session->session_index;
TLS_DBG (1, "Accept on listener %u new connection [%u]%x",
@ -511,7 +516,7 @@ tls_app_rx_callback (session_t * tls_session)
return 0;
ctx = tls_ctx_get (tls_session->opaque);
if (PREDICT_FALSE (ctx->no_app_session))
if (PREDICT_FALSE (ctx->no_app_session || ctx->app_closed))
{
TLS_DBG (1, "Local App closed");
return 0;
@ -938,15 +943,18 @@ tls_cleanup_ho (u32 ho_index)
int
tls_custom_tx_callback (void *session, transport_send_params_t * sp)
{
session_t *app_session = (session_t *) session;
session_t *as = (session_t *) session;
tls_ctx_t *ctx;
if (PREDICT_FALSE (app_session->session_state
>= SESSION_STATE_TRANSPORT_CLOSED))
return 0;
if (PREDICT_FALSE (as->session_state >= SESSION_STATE_TRANSPORT_CLOSED ||
as->session_state <= SESSION_STATE_ACCEPTING))
{
sp->flags |= TRANSPORT_SND_F_DESCHED;
return 0;
}
ctx = tls_ctx_get (app_session->connection_index);
return tls_ctx_write (ctx, app_session, sp);
ctx = tls_ctx_get (as->connection_index);
return tls_ctx_write (ctx, as, sp);
}
u8 *
@ -1057,6 +1065,7 @@ format_tls_half_open (u8 * s, va_list * args)
{
u32 ho_index = va_arg (*args, u32);
u32 __clib_unused thread_index = va_arg (*args, u32);
u32 __clib_unused verbose = va_arg (*args, u32);
session_t *tcp_ho;
tls_ctx_t *ho_ctx;
@ -1102,7 +1111,7 @@ tls_enable (vlib_main_t * vm, u8 is_en)
vnet_app_attach_args_t _a, *a = &_a;
u64 options[APP_OPTIONS_N_OPTIONS];
tls_main_t *tm = &tls_main;
u32 fifo_size = 128 << 12;
u32 fifo_size = 512 << 10;
if (!is_en)
{

View File

@ -152,6 +152,7 @@ clib_file_get_resolved_basename (char *fmt, ...)
if (r < 1)
return 0;
buffer[r] = 0;
p = buffer + r - 1;
while (p > buffer && p[-1] != '/')
p--;
@ -159,6 +160,7 @@ clib_file_get_resolved_basename (char *fmt, ...)
while (p[0])
vec_add1 (s, p++[0]);
vec_add1 (s, 0);
return s;
}