Fix pcap packet acquisition methods passing 0 to pcap_dispatch.
Previously they passed the packet pool size, but the packet_q_len
variable was now hardcoded at 0.
This patch sets packet_q_len to 64. If packet pool is empty, we fall
back to direct alloc. As the pcap_dispatch function is only called
when packet pool is not empty, we alloc at most 63 packets.
{
SCEnter();
- uint16_t packet_q_len = 0;
+ int packet_q_len = 64;
PcapFileThreadVars *ptv = (PcapFileThreadVars *)data;
int r;
TmSlot *s = (TmSlot *)slot;
PacketPoolWait();
/* Right now we just support reading packets one at a time. */
- r = pcap_dispatch(pcap_g.pcap_handle, (int)packet_q_len,
+ r = pcap_dispatch(pcap_g.pcap_handle, packet_q_len,
(pcap_handler)PcapFileCallbackLoop, (u_char *)ptv);
if (unlikely(r == -1)) {
SCLogError(SC_ERR_PCAP_DISPATCH, "error code %" PRId32 " %s",
{
SCEnter();
- uint16_t packet_q_len = 0;
+ int packet_q_len = 64;
PcapThreadVars *ptv = (PcapThreadVars *)data;
int r;
TmSlot *s = (TmSlot *)slot;
PacketPoolWait();
/* Right now we just support reading packets one at a time. */
- r = pcap_dispatch(ptv->pcap_handle, (int)packet_q_len,
+ r = pcap_dispatch(ptv->pcap_handle, packet_q_len,
(pcap_handler)PcapCallbackLoop, (u_char *)ptv);
if (unlikely(r < 0)) {
int dbreak = 0;