aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-05 19:25:44 +0000
committerFlorin Coras <florin.coras@gmail.com>2020-04-06 14:53:31 +0000
commit7a2abce4c9fc2191b3d3989c84516391036b6882 (patch)
tree17067f8d513835444d9fa4a227a8717bf35478fd /src/plugins
parent57660d9df62756c5db1516be0dbb48505f996e82 (diff)
vcl session: enforce full dgram reads/writes
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4a3861e31ca42faf0b59f8f09393fb10413bf3af
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/echo_client.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index 3c55c6dc720..e10ee59a2b7 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -75,17 +75,19 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
}
else
{
+ svm_fifo_t *f = s->data.tx_fifo;
+ u32 max_enqueue = svm_fifo_max_enqueue_prod (f);
+
+ if (max_enqueue < sizeof (session_dgram_hdr_t))
+ return;
+
+ max_enqueue -= sizeof (session_dgram_hdr_t);
+
if (ecm->no_copy)
{
session_dgram_hdr_t hdr;
- svm_fifo_t *f = s->data.tx_fifo;
app_session_transport_t *at = &s->data.transport;
- u32 max_enqueue = svm_fifo_max_enqueue_prod (f);
- if (max_enqueue <= sizeof (session_dgram_hdr_t))
- return;
-
- max_enqueue -= sizeof (session_dgram_hdr_t);
rv = clib_min (max_enqueue, bytes_this_chunk);
hdr.data_length = rv;
@@ -104,8 +106,11 @@ send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
SESSION_IO_EVT_TX);
}
else
- rv = app_send_dgram (&s->data, test_data + test_buf_offset,
- bytes_this_chunk, 0);
+ {
+ bytes_this_chunk = clib_min (bytes_this_chunk, max_enqueue);
+ rv = app_send_dgram (&s->data, test_data + test_buf_offset,
+ bytes_this_chunk, 0);
+ }
}
/* If we managed to enqueue data... */