summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_private.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r--src/vcl/vcl_private.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 3cb76c6bb7d..14582ce025d 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -308,6 +308,8 @@ vcl_cleanup_bapi (void)
int
vcl_session_read_ready (vcl_session_t * session)
{
+ u32 max_deq;
+
/* Assumes caller has acquired spinlock: vcm->sessions_lockp */
if (PREDICT_FALSE (session->is_vep))
{
@@ -335,7 +337,23 @@ vcl_session_read_ready (vcl_session_t * session)
if (vcl_session_is_ct (session))
return svm_fifo_max_dequeue_cons (session->ct_rx_fifo);
- return svm_fifo_max_dequeue_cons (session->rx_fifo);
+ max_deq = svm_fifo_max_dequeue_cons (session->rx_fifo);
+
+ if (session->is_dgram)
+ {
+ session_dgram_pre_hdr_t ph;
+
+ if (max_deq <= SESSION_CONN_HDR_LEN)
+ return 0;
+ if (svm_fifo_peek (session->rx_fifo, 0, sizeof (ph), (u8 *) & ph) < 0)
+ return 0;
+ if (ph.data_length + SESSION_CONN_HDR_LEN > max_deq)
+ return 0;
+
+ return ph.data_length;
+ }
+
+ return max_deq;
}
int