summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
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/vcl/vcl_private.c
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/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 14582ce025d..300b82c4f21 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -390,6 +390,15 @@ vcl_session_write_ready (vcl_session_t * session)
if (vcl_session_is_ct (session))
return svm_fifo_max_enqueue_prod (session->ct_tx_fifo);
+ if (session->is_dgram)
+ {
+ u32 max_enq = svm_fifo_max_enqueue_prod (session->tx_fifo);
+
+ if (max_enq <= sizeof (session_dgram_hdr_t))
+ return 0;
+ return max_enq - sizeof (session_dgram_hdr_t);
+ }
+
return svm_fifo_max_enqueue_prod (session->tx_fifo);
}