diff options
author | Florin Coras <fcoras@cisco.com> | 2021-05-07 19:39:43 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-05-10 20:53:32 +0000 |
commit | ea72764204dac0a1ab6412bc27b758faead2ca10 (patch) | |
tree | d22e849e0e0a84b11c42373c1b97fb6b715d3098 /src/vnet/tcp/tcp.c | |
parent | e2272ac27c31b8cf7ecf0ff8d4244f90034a09f4 (diff) |
session: use half-open sessions for vc establishment
Use half-open sessions to track virtual circuit connection
establishment. These sesssions can only be allocated and freed by the
thread that allocates half-open connections (main). Consequently, they
can only be freed on half-open cleanup notifications from transports.
Goal is to simplify state tracking within the session layer but it's
also a first step towards allowing builtin apps to track and cleanup
outstanding connects.
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I8a535906d13eb7f8966deb82333839de80f8049f
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r-- | src/vnet/tcp/tcp.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index a6c1e216c20..90b832cd73d 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -214,7 +214,7 @@ tcp_half_open_connection_cleanup (tcp_connection_t * tc) if (tc->c_thread_index != vlib_get_thread_index ()) return 1; - session_half_open_delete_notify (TRANSPORT_PROTO_TCP, tc->c_s_ho_handle); + session_half_open_delete_notify (&tc->connection); wrk = tcp_get_worker (tc->c_thread_index); tcp_timer_reset (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN); tcp_half_open_connection_free (tc); @@ -853,8 +853,20 @@ format_tcp_half_open_session (u8 * s, va_list * args) { u32 tci = va_arg (*args, u32); u32 __clib_unused thread_index = va_arg (*args, u32); - tcp_connection_t *tc = tcp_half_open_connection_get (tci); - return format (s, "%U", format_tcp_connection_id, tc); + u32 verbose = va_arg (*args, u32); + tcp_connection_t *tc; + u8 *state = 0; + + tc = tcp_half_open_connection_get (tci); + if (tc->flags & TCP_CONN_HALF_OPEN_DONE) + state = format (state, "%s", "CLOSED"); + else + state = format (state, "%U", format_tcp_state, tc->state); + s = format (s, "%-" SESSION_CLI_ID_LEN "U", format_tcp_connection_id, tc); + if (verbose) + s = format (s, "%-" SESSION_CLI_STATE_LEN "v", state); + vec_free (state); + return s; } static transport_connection_t * |