From c819d7677bafa2b8f899f50895b498275c0a6375 Mon Sep 17 00:00:00 2001 From: David Fifield Date: Mon, 9 Apr 2012 19:48:21 -0700 Subject: [PATCH 4/4] Include before "pcap/bpf.h". On Solaris 11, includes , which defines the symbols bpf_program and bpf_insn. The included "pcap/bpf.h" also includes these symbols, and checks whether any bpf.h has already been included; if so, it doesn't include itself. When the includes go in the other order there is no such guard. This is the error I get on Solaris 11: gcc -O2 -fpic -I. -DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -g -O2 -c ./fad-getad.c In file included from /usr/include/netpacket/packet.h:10:0, from ./fad-getad.c:66: /usr/include/net/bpf.h:73:8: error: redefinition of 'struct bpf_program' ./pcap/bpf.h:107:8: note: originally defined here In file included from /usr/include/netpacket/packet.h:10:0, from ./fad-getad.c:66: /usr/include/net/bpf.h:253:8: error: redefinition of 'struct bpf_insn' ./pcap/bpf.h:109:9: note: originally defined here --- fad-getad.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git fad-getad.c fad-getad.c index 742ae1f..519893a 100644 --- fad-getad.c +++ fad-getad.c @@ -54,12 +54,6 @@ static const char rcsid[] _U_ = #include #include -#include "pcap-int.h" - -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - #ifdef AF_PACKET # ifdef HAVE_NETPACKET_PACKET_H /* Solaris 11 and later, Linux distributions with newer glibc */ @@ -77,6 +71,12 @@ static const char rcsid[] _U_ = # endif /* HAVE_NETPACKET_PACKET_H */ #endif /* AF_PACKET */ +#include "pcap-int.h" + +#ifdef HAVE_OS_PROTO_H +#include "os-proto.h" +#endif + /* * This is fun. * -- 1.7.9.5