summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-20 19:48:31 -0800
committerDamjan Marion <dmarion@me.com>2019-02-21 12:27:03 +0000
commit565115edf0d6689a3f362c69240c160b49807156 (patch)
treecb0dd4a6299fc6ec4fdade0f71fb2f21ac9e33c6
parent0964985cdd99cf769582e0d9393de68a95b121b9 (diff)
tcp: drop outstanding data when entering closing state
Change-Id: I92a009b9630b0d882ea3c5c99aad88ed6f5109a0 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vnet/session/application_worker.c1
-rw-r--r--src/vnet/session/session.c2
-rw-r--r--src/vnet/session/session.h2
-rw-r--r--src/vnet/tcp/tcp_input.c18
4 files changed, 16 insertions, 7 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 3bab3564ad9..5423733b231 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -199,6 +199,7 @@ app_worker_free (app_worker_t * app_wrk)
{
sm = segment_manager_get (app_wrk->connects_seg_manager);
sm->app_wrk_index = SEGMENT_MANAGER_INVALID_APP_INDEX;
+ sm->first_is_protected = 0;
segment_manager_init_del (sm);
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 606f71739bd..83c889c715a 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -462,7 +462,7 @@ stream_session_peek_bytes (transport_connection_t * tc, u8 * buffer,
}
u32
-stream_session_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
+session_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
session_t *s = session_get (tc->s_index, tc->thread_index);
return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 4de7642d29a..f20e0db1d04 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -375,7 +375,7 @@ int session_enqueue_dgram_connection (session_t * s,
u8 queue_event);
int stream_session_peek_bytes (transport_connection_t * tc, u8 * buffer,
u32 offset, u32 max_bytes);
-u32 stream_session_dequeue_drop (transport_connection_t * tc, u32 max_bytes);
+u32 session_dequeue_drop (transport_connection_t * tc, u32 max_bytes);
int session_stream_connect_notify (transport_connection_t * tc, u8 is_fail);
int session_dgram_connect_notify (transport_connection_t * tc,
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index c5dfb3f7372..dbe1fc4de87 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -564,7 +564,7 @@ tcp_handle_postponed_dequeues (tcp_worker_ctx_t * wrk)
continue;
/* Dequeue the newly ACKed bytes */
- stream_session_dequeue_drop (&tc->connection, tc->burst_acked);
+ session_dequeue_drop (&tc->connection, tc->burst_acked);
tc->burst_acked = 0;
tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una);
@@ -2806,8 +2806,7 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
/* Don't try to deq the FIN acked */
if (tc0->burst_acked > 1)
- stream_session_dequeue_drop (&tc0->connection,
- tc0->burst_acked - 1);
+ session_dequeue_drop (&tc0->connection, tc0->burst_acked - 1);
tc0->burst_acked = 0;
}
break;
@@ -2950,8 +2949,17 @@ tcp46_rcv_process_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
case TCP_STATE_FIN_WAIT_1:
tc0->rcv_nxt += 1;
tcp_connection_set_state (tc0, TCP_STATE_CLOSING);
- tcp_program_ack (wrk, tc0);
- /* Wait for ACK but not forever */
+ if (tc0->flags & TCP_CONN_FINPNDG)
+ {
+ /* Drop all outstanding tx data. */
+ session_dequeue_drop (&tc0->connection,
+ transport_max_tx_dequeue
+ (&tc0->connection));
+ tcp_send_fin (tc0);
+ }
+ else
+ tcp_program_ack (wrk, tc0);
+ /* Wait for ACK for our FIN but not forever */
tcp_timer_update (tc0, TCP_TIMER_WAITCLOSE, TCP_2MSL_TIME);
break;
case TCP_STATE_FIN_WAIT_2: