summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-08-07 19:12:38 -0700
committerDave Barach <openvpp@barachs.net>2019-08-09 11:50:04 +0000
commita678974cc52ac61dd6094c3f6649f9e3202be1cb (patch)
tree71d83607448a2668c9fb4fa6b7d624b717ff85f3 /src/vnet/session
parentd09236d17d86a5d50166b2017f8f30a560c6e1b8 (diff)
session: allow closed transports to send
Type:fix Transports like tcp may notify session layer of a close but they may defer the connection's deletion (e.g., tcp time-wait). During that time, transports may still want to send packets. So, unless the session has no transport (transport-deleted state), allow the transport to send. Change-Id: I3ae335c7b951ff64be8529a5e3f3ad790feddc84 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session_node.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index c2e3dd005a8..5af54a8165a 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -512,12 +512,21 @@ session_tx_not_ready (session_t * s, u8 peek_data)
{
if (peek_data)
{
+ if (PREDICT_TRUE (s->session_state == SESSION_STATE_READY))
+ return 0;
/* Can retransmit for closed sessions but can't send new data if
* session is not ready or closed */
- if (s->session_state < SESSION_STATE_READY)
+ else if (s->session_state < SESSION_STATE_READY)
return 1;
- if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
- return 2;
+ else if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED)
+ {
+ /* Allow closed transports to still send custom packets.
+ * For instance, tcp may want to send acks in time-wait. */
+ if (s->session_state != SESSION_STATE_TRANSPORT_DELETED
+ && (s->flags & SESSION_F_CUSTOM_TX))
+ return 0;
+ return 2;
+ }
}
return 0;
}
@@ -639,7 +648,6 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
tp = session_get_transport_proto (ctx->s);
ctx->transport_vft = transport_protocol_get_vft (tp);
ctx->tc = session_tx_get_transport (ctx, peek_data);
- ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc);
if (PREDICT_FALSE (e->event_type == SESSION_IO_EVT_TX_FLUSH))
{
@@ -653,6 +661,9 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
ctx->s->flags &= ~SESSION_F_CUSTOM_TX;
n_custom_tx = ctx->transport_vft->custom_tx (ctx->tc, max_burst);
*n_tx_packets += n_custom_tx;
+ if (PREDICT_FALSE
+ (ctx->s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
+ return SESSION_TX_OK;
max_burst -= n_custom_tx;
if (!max_burst)
{
@@ -661,6 +672,7 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
}
}
+ ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc);
ctx->snd_space = transport_connection_snd_space (ctx->tc,
vm->clib_time.
last_cpu_time,