0

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?

scatman
  • 14,109
  • 22
  • 70
  • 93

1 Answers1

0

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>
caf
  • 233,326
  • 40
  • 323
  • 462