diff options
author | Florin Coras <fcoras@cisco.com> | 2021-04-12 19:55:37 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-04-14 16:01:50 +0000 |
commit | 04ae8273f64a4f5a771da9b056bcccd1ebf9c7d9 (patch) | |
tree | 09597fb999f63e30a22424d9a3a0e616a24c28b9 /src/vnet/session/session_node.c | |
parent | 7bc714da36bb9badec2ad5bf848c6b90caabad0a (diff) |
session tcp vcl: api to update connection attributes
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ifdd6024daf044751895bb8d2deabad41d3a80c92
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index d40411cb547..22ab3e8c064 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -520,6 +520,51 @@ session_mq_app_wrk_rpc_handler (void *data) svm_msg_q_add_and_unlock (app_wrk->event_queue, msg); } +static void +session_mq_transport_attr_handler (void *data) +{ + session_transport_attr_msg_t *mp = (session_transport_attr_msg_t *) data; + session_transport_attr_reply_msg_t *rmp; + svm_msg_q_msg_t _msg, *msg = &_msg; + app_worker_t *app_wrk; + session_event_t *evt; + application_t *app; + session_t *s; + int rv; + + app = application_lookup (mp->client_index); + if (!app) + return; + + if (!(s = session_get_from_handle_if_valid (mp->handle))) + { + clib_warning ("invalid handle %llu", mp->handle); + return; + } + app_wrk = app_worker_get (s->app_wrk_index); + if (app_wrk->app_index != app->app_index) + { + clib_warning ("app %u does not own session %llu", app->app_index, + mp->handle); + return; + } + + rv = session_transport_attribute (s, mp->is_get, &mp->attr); + + svm_msg_q_lock_and_alloc_msg_w_ring ( + app_wrk->event_queue, SESSION_MQ_CTRL_EVT_RING, SVM_Q_WAIT, msg); + evt = svm_msg_q_msg_data (app_wrk->event_queue, msg); + clib_memset (evt, 0, sizeof (*evt)); + evt->event_type = SESSION_CTRL_EVT_TRANSPORT_ATTR_REPLY; + rmp = (session_transport_attr_reply_msg_t *) evt->data; + rmp->handle = mp->handle; + rmp->retval = rv; + rmp->is_get = mp->is_get; + if (!rv && mp->is_get) + rmp->attr = mp->attr; + svm_msg_q_add_and_unlock (app_wrk->event_queue, msg); +} + vlib_node_registration_t session_queue_node; typedef struct @@ -1277,6 +1322,9 @@ session_event_dispatch_ctrl (session_worker_t * wrk, session_evt_elt_t * elt) case SESSION_CTRL_EVT_APP_WRK_RPC: session_mq_app_wrk_rpc_handler (session_evt_ctrl_data (wrk, elt)); break; + case SESSION_CTRL_EVT_TRANSPORT_ATTR: + session_mq_transport_attr_handler (session_evt_ctrl_data (wrk, elt)); + break; default: clib_warning ("unhandled event type %d", e->event_type); } |