summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_output.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-06-07 15:31:06 -0700
committerJohn Lo <loj@cisco.com>2019-06-08 01:36:00 +0000
commit548f75744915c8e1c5e59fb866af0d912d1173a1 (patch)
tree294197a96b0986d87a54eaa727a50e1d3674c527 /src/vnet/tcp/tcp_output.c
parentd9a145f42ec7e05b9066778aefc9c34d4bdaa408 (diff)
tcp: close connection if not recovered after max tries
Type: feature Change-Id: Ia8af6a62a2be2265bc42955d90e8c2222bdb8f50 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp_output.c')
-rw-r--r--src/vnet/tcp/tcp_output.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 03caa075a41..c9ffd00d016 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1517,6 +1517,19 @@ tcp_timer_retransmit_handler_i (u32 index, u8 is_syn)
tcp_update_rto (tc);
}
+ /* Peer is dead or network connectivity is lost. Close connection.
+ * RFC 1122 section 4.2.3.5 recommends a value of at least 100s. For
+ * a min rto of 0.2s we need to retry about 8 times. */
+ if (tc->rto_boff >= TCP_RTO_BOFF_MAX)
+ {
+ tcp_send_reset (tc);
+ tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+ session_transport_closing_notify (&tc->connection);
+ tcp_connection_timers_reset (tc);
+ tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, TCP_CLOSEWAIT_TIME);
+ return;
+ }
+
/* Increment RTO backoff (also equal to number of retries) and go back
* to first un-acked byte */
tc->rto_boff += 1;