aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-12-14 11:46:11 -0800
committerDave Barach <vpp@barachs.net>2023-12-15 00:47:49 +0000
commit6d14c0cc5af3185563c4c7a00fe297cb1301ea03 (patch)
treebab418ca46b310825dac42592963817e891d48ed
parent86b02c728c50d74f9562715c7099e33b977fda5d (diff)
session: add forced reset api to ct transport
Type: improvement Change-Id: Iebf9ee8275a92e962679e3d0d22d33ed0bd8b3ab Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vnet/session/application_local.c12
-rw-r--r--src/vnet/session/application_local.h3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index b14386a9b00..8fd3d44efe0 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -1034,6 +1034,8 @@ global_scope:
static inline int
ct_close_is_reset (ct_connection_t *ct, session_t *s)
{
+ if (ct->flags & CT_CONN_F_RESET)
+ return 1;
if (ct->flags & CT_CONN_F_CLIENT)
return (svm_fifo_max_dequeue (ct->client_rx_fifo) > 0);
else
@@ -1194,6 +1196,15 @@ ct_session_close (u32 ct_index, u32 thread_index)
ct_program_cleanup (ct);
}
+static void
+ct_session_reset (u32 ct_index, u32 thread_index)
+{
+ ct_connection_t *ct;
+ ct = ct_connection_get (ct_index, thread_index);
+ ct->flags |= CT_CONN_F_RESET;
+ ct_session_close (ct_index, thread_index);
+}
+
static transport_connection_t *
ct_session_get (u32 ct_index, u32 thread_index)
{
@@ -1358,6 +1369,7 @@ static const transport_proto_vft_t cut_thru_proto = {
.cleanup_ho = ct_cleanup_ho,
.connect = ct_session_connect,
.close = ct_session_close,
+ .reset = ct_session_reset,
.custom_tx = ct_custom_tx,
.app_rx_evt = ct_app_rx_evt,
.format_listener = format_ct_listener,
diff --git a/src/vnet/session/application_local.h b/src/vnet/session/application_local.h
index 86edf243b22..fd2804c7baf 100644
--- a/src/vnet/session/application_local.h
+++ b/src/vnet/session/application_local.h
@@ -22,7 +22,8 @@
#define foreach_ct_flags \
_ (CLIENT, "client") \
- _ (HALF_OPEN, "half-open")
+ _ (HALF_OPEN, "half-open") \
+ _ (RESET, "reset")
enum
{