Question

i am using pcap sample codes to create my own sniffer. i downloaded their sample sniffer and its working on windows but not on linux. i am using gcc compiler on both machines, and i have only pcap.h included.
the error is : dereferencing pointer to incomplete type.
the netmask is causing the error. the netmask is the mask of the first address of the interface.

u_int netmask=netmask((struct sockaddr_in*)d->addresses->netmask))->sin_addr.S_un.S_addr;  

any solutions?

Was it helpful?

Solution

The compiler indicating that it doesn't have the definition of struct sockaddr_in in scope, so it can't look inside such a structure. On Linux that struct is defined in this header, which you will need to include:

#include <netinet/in.h>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top