summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-08-16 17:48:44 -0700
committerJohn Lo <loj@cisco.com>2019-09-20 21:36:26 +0000
commita267cba29c449b5b06c18670280b899da7dd2511 (patch)
tree058b9b0a4b48b26e894f63e100f786f230c79cdf /src/vnet/tcp
parent7fe501a4b585f87bb095a2b023c381cd8baa2abe (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> (cherry picked from commit dfb3b8771292e4c863ca266856aa2b5eb7cc7518)
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,