aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-08-31 17:33:47 -0700
committerDave Barach <vpp@barachs.net>2023-09-04 00:08:40 +0000
commit2ceb818f8eca4b8aebd0a4f2b36a641c832d8819 (patch)
treea76fd431321eb044c7ba883e6ca51dfbd918ff25 /src/vnet
parent23d13c071e80ab6bbed4f5d6cf14ef9ccf05384a (diff)
session: fix allocation of proxy fifos
Fifos need to be synchronously allocated once a transport like tcp accepts a session. Since events are now delivered asynchronously, proxy apps must explicitly register a cb function that manages fifo allocation prior to being notified of connect event. Type: fix Fixes: 0242d30 Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7df973b7014e53e0766ea2bdc61e9871160bc18b
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application_interface.h2
-rw-r--r--src/vnet/session/application_local.c1
-rw-r--r--src/vnet/session/application_worker.c2
-rw-r--r--src/vnet/session/session.c2
-rw-r--r--src/vnet/tls/tls.c1
5 files changed, 7 insertions, 1 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index d76b9f7fd8b..b41f7a4c43f 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -74,6 +74,8 @@ typedef struct session_cb_vft_
/** Delegate fifo-tuning-logic to application */
int (*fifo_tuning_callback) (session_t * s, svm_fifo_t * f,
session_ft_action_t act, u32 bytes);
+ /** Custom fifo allocation for proxy */
+ int (*proxy_alloc_session_fifos) (session_t *s);
} session_cb_vft_t;
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 192c22b659a..e3451531a48 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -379,6 +379,7 @@ ct_session_connect_notify (session_t *ss, session_error_t err)
session_set_state (cs, SESSION_STATE_CONNECTING);
cs->app_wrk_index = client_wrk->wrk_index;
cs->connection_index = cct->c_c_index;
+ cs->opaque = opaque;
cct->c_s_index = cs->session_index;
/* This will allocate fifos for the session. They won't be used for
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 9e4b147ccf0..a806c4ad13d 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -406,7 +406,7 @@ app_worker_init_connected (app_worker_t * app_wrk, session_t * s)
/* Allocate fifos for session, unless the app is a builtin proxy */
if (application_is_builtin_proxy (app))
- return 0;
+ return app->cb_fns.proxy_alloc_session_fifos (s);
sm = app_worker_get_connect_segment_manager (app_wrk);
return app_worker_alloc_session_fifos (sm, s);
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index b494041f9eb..1f73eefd773 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -920,6 +920,7 @@ session_stream_connect_notify (transport_connection_t * tc,
s = session_alloc_for_connection (tc);
session_set_state (s, SESSION_STATE_CONNECTING);
s->app_wrk_index = app_wrk->wrk_index;
+ s->opaque = opaque;
new_si = s->session_index;
new_ti = s->thread_index;
@@ -1342,6 +1343,7 @@ session_open_cl (session_endpoint_cfg_t *rmt, session_handle_t *rsh)
app_wrk = app_worker_get (rmt->app_wrk_index);
s = session_alloc_for_connection (tc);
s->app_wrk_index = app_wrk->wrk_index;
+ s->opaque = rmt->opaque;
session_set_state (s, SESSION_STATE_OPENED);
if (app_worker_init_connected (app_wrk, s))
{
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index 8175e22097a..f229902ba68 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -224,6 +224,7 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
}
app_session->app_wrk_index = ctx->parent_app_wrk_index;
+ app_session->opaque = ctx->parent_app_api_context;
if ((err = app_worker_init_connected (app_wrk, app_session)))
goto failed;