aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-31 17:17:11 -0700
committerDave Barach <openvpp@barachs.net>2019-04-02 16:48:39 +0000
commitf65074e4df47d05238e051615dbaf5d2bcbaddf2 (patch)
tree5498cb0d07c0c19cd530ef17f35a5607c1319136 /src/vnet/tcp/tcp.c
parentc6c4394dbd4a128d07d0a0a72c4db7d132f4474e (diff)
tcp: improve rcv process ack processing
- Avoid doing cc in closing states. - Rest connections closed with unread data Change-Id: I97d46b0459f03ea5439eeb0f233b6c17d3e06dfd Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r--src/vnet/tcp/tcp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index e262513687f..09c47d989ac 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -350,6 +350,15 @@ tcp_connection_close (tcp_connection_t * tc)
tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, TCP_FINWAIT1_TIME);
break;
case TCP_STATE_ESTABLISHED:
+ /* If closing with unread data, reset the connection */
+ if (transport_max_rx_dequeue (&tc->connection))
+ {
+ tcp_send_reset (tc);
+ tcp_connection_timers_reset (tc);
+ tcp_connection_set_state (tc, TCP_STATE_CLOSED);
+ tcp_timer_set (tc, TCP_TIMER_WAITCLOSE, TCP_CLOSEWAIT_TIME);
+ break;
+ }
if (!transport_max_tx_dequeue (&tc->connection))
tcp_send_fin (tc);
else