From 11c0549fee379a170f18d9e427ce87bb6965ddaf Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 10 May 2017 12:29:14 -0700 Subject: [PATCH] Handle RST of TCP connections in SYN-RCVD state, VPP-822 Change-Id: Ieb0c1e690d6ae082cfedb276252a31fab480e561 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index a65ab7ffac4..e365fa0ed82 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); } /** -- 2.16.6