diff --git a/configure.ac b/configure.ac index b05739f50a..ecdc00ab21 100644 --- a/configure.ac +++ b/configure.ac @@ -94,12 +94,19 @@ AC_INIT(configure.ac) # Checks for libraries. # Checks for header files. - AC_CHECK_HEADERS([arpa/inet.h inttypes.h limits.h netdb.h poll.h signal.h stdint.h stdlib.h string.h syslog.h sys/ioctl.h sys/prctl.h sys/socket.h sys/syscall.h netinet/in.h sys/time.h unistd.h windows.h winsock2.h ws2tcpip.h sched.h assert.h]) - AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h], [], [], + AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h]) + AC_CHECK_HEADERS([getopt.h]) + AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h]) + AC_CHECK_HEADERS([stdarg.h stdint.h stdio.h stdlib.h string.h sys/ioctl.h]) + AC_CHECK_HEADERS([syslog.h sys/prctl.h sys/socket.h sys/stat.h sys/syscall.h]) + AC_CHECK_HEADERS([sys/time.h time.h unistd.h windows.h winsock2.h ws2tcpip.h]) + AC_CHECK_HEADERS([sys/ioctl.h linux/if_ether.h linux/if_packet.h linux/filter.h]) + + AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [], [[#ifdef HAVE_SYS_SOCKET_H -#include -#include -#endif + #include + #include + #endif ]]) @@ -846,7 +853,7 @@ AC_INIT(configure.ac) if test "$with_libpcap_libraries" != "no"; then LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}" fi - AC_CHECK_HEADERS([pcap.h pcap/pcap.h]) + AC_CHECK_HEADERS([pcap.h pcap/pcap.h pcap/bpf.h]) LIBPCAP="" AC_CHECK_LIB(pcap, pcap_open_live,, LIBPCAP="no", [-lpthread]) diff --git a/src/app-layer-htp-body.c b/src/app-layer-htp-body.c index 970fc79faf..3795d1cd20 100644 --- a/src/app-layer-htp-body.c +++ b/src/app-layer-htp-body.c @@ -50,7 +50,6 @@ #include "app-layer-htp.h" #include "app-layer-htp-file.h" #include "util-time.h" -#include #include "util-unittest.h" #include "util-unittest-helper.h" diff --git a/src/app-layer-htp-file.c b/src/app-layer-htp-file.c index 80aa6a349c..b8d526dcbc 100644 --- a/src/app-layer-htp-file.c +++ b/src/app-layer-htp-file.c @@ -47,7 +47,6 @@ #include "util-debug.h" #include "app-layer-htp.h" #include "util-time.h" -#include #include "util-unittest.h" #include "util-unittest-helper.h" diff --git a/src/conf.c b/src/conf.c index be06794861..4d3f5e0836 100644 --- a/src/conf.c +++ b/src/conf.c @@ -36,8 +36,6 @@ * stays approach? */ -#include - #include "suricata-common.h" #include "conf.h" #include "util-unittest.h" diff --git a/src/detect-engine-payload.c b/src/detect-engine-payload.c index b6b507cf55..7d7306973f 100644 --- a/src/detect-engine-payload.c +++ b/src/detect-engine-payload.c @@ -452,7 +452,6 @@ static int PayloadTestSig13(void) "content:\"aa\"; content:\"aa\"; distance:0; content:\"aa\"; distance:0; " "byte_test:1,>,200,0,relative; sid:1;)"; -#include struct timeval tv_start, tv_end, tv_diff; gettimeofday(&tv_start, NULL); diff --git a/src/detect-engine-sigorder.c b/src/detect-engine-sigorder.c index b4a20ac56f..6f01e4de77 100644 --- a/src/detect-engine-sigorder.c +++ b/src/detect-engine-sigorder.c @@ -23,11 +23,6 @@ * Signature ordering part of the detection engine. */ -#include -#include -#include -#include - #include "suricata-common.h" #include "detect.h" #include "detect-flowbits.h" diff --git a/src/detect-http-client-body.c b/src/detect-http-client-body.c index a73238b736..b5336ff11a 100644 --- a/src/detect-http-client-body.c +++ b/src/detect-http-client-body.c @@ -53,7 +53,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-client-body.h" #include "stream-tcp.h" diff --git a/src/detect-http-cookie.c b/src/detect-http-cookie.c index 0d1b9d99a2..5fb7b399d7 100644 --- a/src/detect-http-cookie.c +++ b/src/detect-http-cookie.c @@ -55,7 +55,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-cookie.h" #include "stream-tcp.h" diff --git a/src/detect-http-header.c b/src/detect-http-header.c index 1fe3c45c56..1990ccd2f8 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -54,7 +54,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-header.h" #include "stream-tcp.h" diff --git a/src/detect-http-method.c b/src/detect-http-method.c index c2968d9069..8666fbf34b 100644 --- a/src/detect-http-method.c +++ b/src/detect-http-method.c @@ -54,7 +54,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-method.h" #include "stream-tcp.h" diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index 8f5ad07f24..88c15a2eeb 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -54,7 +54,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-raw-header.h" #include "stream-tcp.h" diff --git a/src/detect-http-raw-uri.c b/src/detect-http-raw-uri.c index f2dc7a0168..4b541d1075 100644 --- a/src/detect-http-raw-uri.c +++ b/src/detect-http-raw-uri.c @@ -50,7 +50,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-raw-uri.h" #include "stream-tcp.h" diff --git a/src/detect-http-server-body.c b/src/detect-http-server-body.c index 3982426345..b0d3db4847 100644 --- a/src/detect-http-server-body.c +++ b/src/detect-http-server-body.c @@ -54,7 +54,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-server-body.h" #include "stream-tcp.h" diff --git a/src/detect-http-stat-code.c b/src/detect-http-stat-code.c index c0cca4e2ad..c973a6f5b9 100644 --- a/src/detect-http-stat-code.c +++ b/src/detect-http-stat-code.c @@ -56,7 +56,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-stat-code.h" #include "stream-tcp-private.h" diff --git a/src/detect-http-stat-msg.c b/src/detect-http-stat-msg.c index 824b86ef3f..405e9a86e9 100644 --- a/src/detect-http-stat-msg.c +++ b/src/detect-http-stat-msg.c @@ -56,7 +56,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-stat-msg.h" #include "stream-tcp-private.h" diff --git a/src/detect-http-ua.c b/src/detect-http-ua.c index 0d1050e9c0..fdaa0e6335 100644 --- a/src/detect-http-ua.c +++ b/src/detect-http-ua.c @@ -53,7 +53,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "stream-tcp.h" #include "detect-http-ua.h" diff --git a/src/detect-http-uri.c b/src/detect-http-uri.c index 78d4003a06..6297939777 100644 --- a/src/detect-http-uri.c +++ b/src/detect-http-uri.c @@ -50,7 +50,6 @@ #include "app-layer.h" -#include #include "app-layer-htp.h" #include "detect-http-uri.h" #include "detect-uricontent.h" diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 847ac0d14e..3e10f1b258 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -57,7 +57,6 @@ #include "app-layer-parser.h" #include "app-layer-htp.h" -#include #include "stream.h" diff --git a/src/log-httplog.c b/src/log-httplog.c index 4a83f57b3a..f4c6b426c6 100644 --- a/src/log-httplog.c +++ b/src/log-httplog.c @@ -24,8 +24,6 @@ * Implements http logging portion of the engine. */ -#include - #include "suricata-common.h" #include "debug.h" #include "detect.h" diff --git a/src/source-af-packet.c b/src/source-af-packet.c index 2591ea20c9..6848a333e9 100644 --- a/src/source-af-packet.c +++ b/src/source-af-packet.c @@ -56,17 +56,32 @@ #include "runmodes.h" #ifdef HAVE_AF_PACKET + +#if HAVE_SYS_IOCTL_H #include +#endif + +#if HAVE_LINUX_IF_ETHER_H #include +#endif + +#if HAVE_LINUX_IF_PACKET_H #include +#endif + +#if HAVE_LINUX_IF_ARP_H #include +#endif -#include -#include +#if HAVE_LINUX_FILTER_H #include #endif +#if HAVE_SYS_MMAN_H #include +#endif + +#endif /* HAVE_AF_PACKET */ extern uint8_t suricata_ctl_flags; extern int max_pending_packets; diff --git a/src/source-nfq.c b/src/source-nfq.c index 03f48fa502..3d1626ac95 100644 --- a/src/source-nfq.c +++ b/src/source-nfq.c @@ -102,7 +102,6 @@ TmEcode NoNFQSupportExit(ThreadVars *tv, void *initdata, void **data) } #else /* implied we do have NFQ support */ -#include extern int max_pending_packets; diff --git a/src/suricata-common.h b/src/suricata-common.h index 68e16e45c2..20d10a6014 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -40,22 +40,53 @@ #include #endif +#if HAVE_STDIO_H #include +#endif + +#if HAVE_STDINT_h #include +#endif + +#if HAVE_STDARG_H #include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#if HAVE_ERRNO_H #include +#endif + #if HAVE_UNISTD_H #include #endif + #if HAVE_INTTYPES_H #include #endif + +#if HAVE_LIMITS_H #include +#endif + +#if HAVE_CTYPE_H #include +#endif + +#if HAVE_STRING_H #include +#endif + +#if HAVE_FCNTL_H #include +#endif + +#ifdef HAVE_TIME_H #include +#endif #if HAVE_SYS_SYSCALL_H #include @@ -112,7 +143,9 @@ #include #endif +#if HAVE_SYS_STAT_H #include +#endif #if HAVE_NETINET_IN_H #include @@ -156,6 +189,10 @@ #include #endif +#ifdef HAVE_PCAP_BPF_H +#include +#endif + /* we need this to stringify the defines which are supplied at compiletime see: http://gcc.gnu.org/onlinedocs/gcc-3.4.1/cpp/Stringification.html#Stringification */ #define xstr(s) str(s) diff --git a/src/suricata.c b/src/suricata.c index 27399279c1..1e5e2af97e 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -24,9 +24,13 @@ #include "suricata-common.h" #include "config.h" +#if HAVE_GETOPT_H #include +#endif + +#if HAVE_SIGNAL_H #include -#include +#endif #ifdef HAVE_NSS #include diff --git a/src/tm-threads.c b/src/tm-threads.c index 6a403752e6..883e9c3f1a 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -36,8 +36,6 @@ #include "tmqh-packetpool.h" #include "threads.h" #include "util-debug.h" -#include -#include #include "util-privs.h" #include "util-cpu.h" #include "util-optimize.h" diff --git a/src/util-cpu.c b/src/util-cpu.c index f36b54702d..18cc12151f 100644 --- a/src/util-cpu.c +++ b/src/util-cpu.c @@ -23,11 +23,6 @@ * Retrieve CPU information (configured CPUs, online CPUs) */ -#include -#include -#include -#include -#include #include "util-error.h" #include "util-debug.h" #include "suricata-common.h" diff --git a/src/util-debug-filters.c b/src/util-debug-filters.c index 72288d1623..6a8b9233de 100644 --- a/src/util-debug-filters.c +++ b/src/util-debug-filters.c @@ -24,17 +24,6 @@ */ #include "suricata-common.h" -#include -#include -#include -#include - -#include "threads.h" -#include "util-debug.h" -#include "util-debug-filters.h" -#include "util-error.h" -#include "util-enum.h" -#include /* both of these are defined in util-debug.c */ extern int sc_log_module_initialized; diff --git a/src/util-decode-der-get.c b/src/util-decode-der-get.c index 75972acbcc..f2ac3f74be 100644 --- a/src/util-decode-der-get.c +++ b/src/util-decode-der-get.c @@ -32,17 +32,6 @@ * */ -#include -#include -#include -#include - -#include - -#include -#include -#include - #include "suricata-common.h" #include "util-decode-der.h" diff --git a/src/util-decode-der.c b/src/util-decode-der.c index 67ba9f2905..bc4eb7a706 100644 --- a/src/util-decode-der.c +++ b/src/util-decode-der.c @@ -43,17 +43,6 @@ * */ -#include -#include -#include -#include - -#include - -#include -#include -#include - #include "suricata-common.h" #include "util-decode-der.h"