aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-08-16 17:48:44 -0700
committerDamjan Marion <dmarion@me.com>2019-08-19 09:22:59 +0000
commitdfb3b8771292e4c863ca266856aa2b5eb7cc7518 (patch)
tree07d808f098db401d045706cb32994cc2630ea2ed /src/vnet/tcp
parent12f6936cd8f69f17820ef749515fcf4d50001c60 (diff)
session: add explicit reset api
Type: feature This can be used to forcefully close a session. It's only available to builtin applications for now. Transports must support the reset api otherwise normal close is used. Change-Id: I5e6d681cbc4c8045385e293e0e9d86fa2bf45849 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 44ee8c8bfcb..f9cb2a28e27 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -477,6 +477,18 @@ tcp_session_cleanup (u32 conn_index, u32 thread_index)
tcp_connection_cleanup (tc);
}
+static void
+tcp_session_reset (u32 conn_index, u32 thread_index)
+{
+ tcp_connection_t *tc;
+ tc = tcp_connection_get (conn_index, thread_index);
+ session_transport_closed_notify (&tc->connection);
+ tcp_send_reset (tc);
+ tcp_connection_timers_reset (tc);
+ tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+ tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, tcp_cfg.cleanup_time);
+}
+
/**
* Initialize all connection timers as invalid
*/
@@ -1258,6 +1270,7 @@ const static transport_proto_vft_t tcp_proto = {
.connect = tcp_session_open,
.close = tcp_session_close,
.cleanup = tcp_session_cleanup,
+ .reset = tcp_session_reset,
.send_mss = tcp_session_send_mss,
.send_space = tcp_session_send_space,
.update_time = tcp_update_time,