Error while compiling packet capturing code on FC2
I wrote a packet sniffer on RH 9 using pcap library a year ago. Now i installed FC2 and tried to run the code there and i get this error:
Warning: Kernel filter failed: Invalid argument
when i run the program.
The program is as follows:
int main(int count, char *cmdln)
struct bpf_program fp;
printf("\nUsage: ./filtercapn [expression] [n]\n");
n=-1; //This will put the capturing into infinite loop
//Open device for reading
//Get the network IP address and the network mask.
//Compile the packet condition into filter program
//Set the filter program
//Send each packet captured according to the filter to the packet_analyser()
The error is comming in the pcap_filter() function as the kernel is not able to set the filter and gives the invalid filter error but the same filter string works fine with tcpdump.
Please help me out,
Rest is fine,
Last edited by Prakhardeep; 02-01-2005 at 04:54 AM.