X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fsnort%2Fdaq_vpp.c;h=386092a03820008d3da918ba8020c95f570f109b;hb=ff344a98a;hp=ec89b0c114e469e71bad77a8354b4e1c607bd740;hpb=a13100f3aa21a39de991df9fff84cd91e4be3b80;p=vpp.git diff --git a/src/plugins/snort/daq_vpp.c b/src/plugins/snort/daq_vpp.c index ec89b0c114e..386092a0382 100644 --- a/src/plugins/snort/daq_vpp.c +++ b/src/plugins/snort/daq_vpp.c @@ -543,6 +543,7 @@ vpp_daq_msg_receive_one (VPP_Context_t *vc, VPPQueuePair *qp, dd->pkthdr.pktlen = d->length; dd->pkthdr.address_space_id = d->address_space_id; dd->msg.data = vc->bpools[d->buffer_pool].base + d->offset; + dd->msg.data_len = d->length; next = next + 1; msgs[0] = &dd->msg; @@ -561,7 +562,8 @@ vpp_daq_msg_receive (void *handle, const unsigned max_recv, { VPP_Context_t *vc = (VPP_Context_t *) handle; uint32_t n_qpairs_left = vc->num_qpairs; - uint32_t n, n_events, n_recv = 0; + uint32_t n, n_recv = 0; + int32_t n_events; /* If the receive has been interrupted, break out of loop and return. */ if (vc->interrupted) @@ -605,9 +607,14 @@ vpp_daq_msg_receive (void *handle, const unsigned max_recv, n_events = epoll_wait (vc->epoll_fd, vc->epoll_events, vc->num_qpairs, 1000); - if (n_events < 1) + if (n_events == 0) { - *rstat = n_events == -1 ? DAQ_RSTAT_ERROR : DAQ_RSTAT_TIMEOUT; + *rstat = DAQ_RSTAT_TIMEOUT; + return 0; + } + if (n_events < 0) + { + *rstat = errno == EINTR ? DAQ_RSTAT_TIMEOUT : DAQ_RSTAT_ERROR; return 0; } @@ -621,8 +628,7 @@ vpp_daq_msg_receive (void *handle, const unsigned max_recv, msgs += n; n_recv += n; } - - (void) read (qp->enq_fd, &ctr, sizeof (ctr)); + ssize_t __clib_unused size = read (qp->enq_fd, &ctr, sizeof (ctr)); } *rstat = DAQ_RSTAT_OK;