With the following code, I get this error when I run the executable file:
...
dev = pcap_lookupdev(errbuf);
if(dev == NULL)
{
printf("%s\n",errbuf);
exit(1);
}
printf("DEV: %s\n",dev);
descr = pcap_open_live(dev,BUFSIZ,0,-1,errbuf);
if(descr == NULL)
{
printf("pcap_open_live(): %s\n",errbuf);
exit(1);
}
packet = pcap_next(descr,&hdr);
if(packet == NULL)
{
printf("Didn't grab packet\n");
exit(1);
}
...
And the error:
pcap_open_live(): gbeth0: BIOCSRTIMEOUT: Invalid argument
When I change
descr = pcap_open_live(dev,BUFSIZ,0,-1,errbuf);
to
descr = pcap_open_live(dev,BUFSIZ,0,1,errbuf);
sniffer does not grab anything and the program exit with this error: Didn't grab packet and when I change 1 to 0 it does not grab anything but with errors. What should I do?