diff options
author | Florin Coras <fcoras@cisco.com> | 2020-03-29 18:54:04 +0000 |
---|---|---|
committer | Florin Coras <fcoras@cisco.com> | 2020-04-01 20:24:38 +0000 |
commit | 0a1e183e5aa45fb0050eb03e1c8ebdb9f426a374 (patch) | |
tree | dc3a7789b55bebff61d566d54e4801536691bd7a /src/vcl/vcl_private.c | |
parent | 9076789779c5a038ec17936130a556703c234fa8 (diff) |
session udp: support connect on listeners
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I6aaaec20a2b6d4c6ddfbe659d9402acc1be2f7e2
Diffstat (limited to 'src/vcl/vcl_private.c')
-rw-r--r-- | src/vcl/vcl_private.c | 20 |
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 |