It seems that, in some case, there is a read waiting but the
offset in the ring buffer is not correct and Suricata need to
walk the ring to find the correct place and make the read.
{
Packet *p = NULL;
union thdr h;
+ int read_pkts = 0;
/* Loop till we have packets available */
while (1) {
SCReturnInt(AFP_FAILURE);
}
if (h.h2->tp_status == TP_STATUS_KERNEL) {
+ if (read_pkts == 0) {
+ if (++ptv->frame_offset >= ptv->req.tp_frame_nr) {
+ ptv->frame_offset = 0;
+ }
+ continue;
+ }
SCReturnInt(AFP_READ_OK);
}
+ read_pkts++;
+
p = PacketGetFromQueueOrAlloc();
if (p == NULL) {
SCReturnInt(AFP_FAILURE);