tcp: generate closed notifications whenever tcp closes 83/20783/4
authorFlorin Coras <fcoras@cisco.com>
Tue, 23 Jul 2019 03:55:11 +0000 (20:55 -0700)
committerDave Barach <openvpp@barachs.net>
Tue, 23 Jul 2019 14:56:50 +0000 (14:56 +0000)
Type: fix

This gives the session layer a chance to to cleanup events.

Change-Id: I7499e94acf06340e2b19a1d91a4c61a63cd66c52
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp_input.c

index 7974190..f0d6478 100644 (file)
@@ -347,6 +347,7 @@ tcp_connection_reset (tcp_connection_t * tc)
       tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLOSEWAIT_TIME);
       session_transport_reset_notify (&tc->connection);
       tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+      session_transport_closed_notify (&tc->connection);
       break;
     case TCP_STATE_CLOSE_WAIT:
     case TCP_STATE_FIN_WAIT_1:
@@ -359,6 +360,7 @@ tcp_connection_reset (tcp_connection_t * tc)
        * be still trying to send data */
       session_transport_closed_notify (&tc->connection);
       tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+      session_transport_closed_notify (&tc->connection);
       break;
     case TCP_STATE_CLOSED:
     case TCP_STATE_TIME_WAIT:
@@ -408,6 +410,7 @@ tcp_connection_close (tcp_connection_t * tc)
          tcp_connection_timers_reset (tc);
          tcp_connection_set_state (tc, TCP_STATE_CLOSED);
          tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLOSEWAIT_TIME);
+         session_transport_closed_notify (&tc->connection);
          break;
        }
       if (!transport_max_tx_dequeue (&tc->connection))
@@ -1351,12 +1354,12 @@ tcp_timer_waitclose_handler (u32 conn_index)
       break;
     case TCP_STATE_FIN_WAIT_1:
       tcp_connection_timers_reset (tc);
+      session_transport_closed_notify (&tc->connection);
       if (tc->flags & TCP_CONN_FINPNDG)
        {
          /* If FIN pending, we haven't sent everything, but we did try.
           * Notify session layer that transport is closed. */
          tcp_connection_set_state (tc, TCP_STATE_CLOSED);
-         session_transport_closed_notify (&tc->connection);
          tcp_send_reset (tc);
          tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLEANUP_TIME);
        }
index 6be6c3a..5f37648 100755 (executable)
@@ -2824,6 +2824,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                {
                  tcp_connection_set_state (tc0, TCP_STATE_CLOSED);
                  tcp_timer_set (tc0, TCP_TIMER_WAITCLOSE, TCP_CLEANUP_TIME);
+                 session_transport_closed_notify (&tc0->connection);
                  goto drop;
                }
 
@@ -2898,6 +2899,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
            }
 
          tcp_connection_set_state (tc0, TCP_STATE_CLOSED);
+         session_transport_closed_notify (&tc0->connection);
 
          /* Don't free the connection from the data path since
           * we can't ensure that we have no packets already enqueued