tcpdump mailing list archives
pcap_offline_read return value
From: Martin Dubuc <martind1111 () gmail com>
Date: Mon, 12 Dec 2016 09:53:31 -0500
I was testing some of the libpcap API and would like to get some
clarification on the return value of one of the function. Is pcap_dispatch
supposed to return the number of packets read/processed? In my sample code,
it always return 0. I tried to trace the code execution and found out that
pcap_offline_read returned 0 instead of packet count if the return
value comes from executing the following block:
status = p->next_packet_op(p, &h, &data);
if (status) {
if (status == 1)
return (0);
return (status);
}
p->next_packet_op translates to pcap_next_packet and this function returns
0 on success or 1 if there are no more packets. In both cases, 0 will be
returned.
This is the case in both 1.7.4 and 1.8.1.
Is this intended?
Martin
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- pcap_offline_read return value Martin Dubuc (Dec 12)
- Re: pcap_offline_read return value Guy Harris (Dec 12)
