aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-05-10 12:29:14 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-05-11 13:28:08 +0000
commit11c0549fee379a170f18d9e427ce87bb6965ddaf (patch)
treef022a2a0b51c890ed3d881d26c426207a3a7de14 /src/vnet/tcp
parentcd6cb986ed35db7e8bd2d702b595f2de065dc80f (diff)
Handle RST of TCP connections in SYN-RCVD state, VPP-822
Change-Id: Ieb0c1e690d6ae082cfedb276252a31fab480e561 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r--src/vnet/tcp/tcp.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index a65ab7ff..e365fa0e 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -150,15 +150,30 @@ tcp_connection_del (tcp_connection_t * tc)
void
tcp_connection_reset (tcp_connection_t * tc)
{
- if (tc->state == TCP_STATE_CLOSED)
- return;
-
- tc->state = TCP_STATE_CLOSED;
-
- /* Make sure all timers are cleared */
- tcp_connection_timers_reset (tc);
+ switch (tc->state)
+ {
+ case TCP_STATE_SYN_RCVD:
+ /* Cleanup everything. App wasn't notified yet */
+ stream_session_delete_notify (&tc->connection);
+ tcp_connection_cleanup (tc);
+ break;
+ case TCP_STATE_SYN_SENT:
+ case TCP_STATE_ESTABLISHED:
+ case TCP_STATE_CLOSE_WAIT:
+ case TCP_STATE_FIN_WAIT_1:
+ case TCP_STATE_FIN_WAIT_2:
+ case TCP_STATE_CLOSING:
+ tc->state = TCP_STATE_CLOSED;
+
+ /* Make sure all timers are cleared */
+ tcp_connection_timers_reset (tc);
+
+ stream_session_reset_notify (&tc->connection);
+ break;
+ case TCP_STATE_CLOSED:
+ return;
+ }
- stream_session_reset_notify (&tc->connection);
}
/**