I added the following function to the sniffex code (http://www.tcpdump.org/sniffex.c):
typedef struct pcap_stat mystat;
mystat *mystatp;
/* Put the interface in statstics mode */
if(pcap_stats(handle, mystatp) < 0)
{
fprintf(stderr,"\nError setting the mode.\n");
pcap_close(handle);
/* Free the device list */
return;
}
Sniffex code is working fine for me – but as soon as I add this code, I am getting a segmentation fault error 🙁
Can anyone please help me out ?
Thanks a ton.
I believe you forgot to allocate memory for mystat.
Try this:
In Pcap.Net I use
pcap_stats_ex()but it’s probably only available on WinPcap and not on libpcap.