APP_OPTIONS_RX_FIFO_SIZE,
APP_OPTIONS_TX_FIFO_SIZE,
APP_OPTIONS_PREALLOC_FIFO_PAIRS,
+ APP_OPTIONS_PREALLOC_FIFO_HDRS,
APP_OPTIONS_NAMESPACE,
APP_OPTIONS_NAMESPACE_SECRET,
APP_OPTIONS_PROXY_TRANSPORT,
ip46_address_t ip;
u32 ckpair_index;
u8 crypto_engine;
+ u8 flags;
} __clib_packed session_listen_msg_t;
STATIC_ASSERT (sizeof (session_listen_msg_t) <= SESSION_CTRL_MSG_MAX_SIZE,
typedef struct session_cleanup_msg_
{
session_handle_t handle;
+ u8 type;
} __clib_packed session_cleanup_msg_t;
typedef struct app_session_event_
int rv;
max_enqueue = svm_fifo_max_enqueue_prod (f);
- if (max_enqueue <= sizeof (session_dgram_hdr_t))
+ if (max_enqueue < (sizeof (session_dgram_hdr_t) + len))
return 0;
max_enqueue -= sizeof (session_dgram_hdr_t);
svm_fifo_peek (f, 0, sizeof (ph), (u8 *) & ph);
ASSERT (ph.data_length >= ph.data_offset);
- if (!ph.data_offset)
- svm_fifo_peek (f, sizeof (ph), sizeof (*at), (u8 *) at);
+
+ /* Check if we have the full dgram */
+ if (max_deq < (ph.data_length + SESSION_CONN_HDR_LEN)
+ && len >= ph.data_length)
+ return 0;
+
+ svm_fifo_peek (f, sizeof (ph), sizeof (*at), (u8 *) at);
len = clib_min (len, ph.data_length - ph.data_offset);
rv = svm_fifo_peek (f, ph.data_offset + SESSION_CONN_HDR_LEN, len, buf);
if (peek)
return rv;
- ASSERT (rv > 0);
- ph.data_offset += rv;
- if (ph.data_offset == ph.data_length)
- svm_fifo_dequeue_drop (f, ph.data_length + SESSION_CONN_HDR_LEN);
- else
- svm_fifo_overwrite_head (f, (u8 *) & ph, sizeof (ph));
+
+ /* Discards data that did not fit in buffer */
+ svm_fifo_dequeue_drop (f, ph.data_length + SESSION_CONN_HDR_LEN);
+
return rv;
}