From: Eric Leblond Date: Thu, 12 Feb 2015 21:27:07 +0000 (+0100) Subject: pcap-file: add missing atomic init X-Git-Tag: suricata-2.1beta4~184 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee7422de0a79054f0271b40fb17dc21d6b12a675;p=thirdparty%2Fsuricata.git pcap-file: add missing atomic init It is mandatory to init all atomic to avoid problem on system without atomic support. --- diff --git a/src/runmode-pcap-file.c b/src/runmode-pcap-file.c index 4265585644..f5a3c196b4 100644 --- a/src/runmode-pcap-file.c +++ b/src/runmode-pcap-file.c @@ -24,6 +24,8 @@ #include "output.h" #include "detect-engine-mpm.h" +#include "source-pcap-file.h" + #include "alert-fastlog.h" #include "alert-prelude.h" #include "alert-unified2-alert.h" @@ -74,6 +76,8 @@ int RunModeFilePcapSingle(DetectEngineCtx *de_ctx) RunModeInitialize(); TimeModeSetOffline(); + PcapFileGlobalInit(); + /* create the threads */ ThreadVars *tv = TmThreadCreatePacketHandler("PcapFile", "packetpool", "packetpool", @@ -164,6 +168,8 @@ int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx) TimeModeSetOffline(); + PcapFileGlobalInit(); + /* Available cpus */ uint16_t ncpus = UtilCpuGetNumProcessorsOnline(); diff --git a/src/source-pcap-file.c b/src/source-pcap-file.c index 8638bdd8d2..f7dcb4c062 100644 --- a/src/source-pcap-file.c +++ b/src/source-pcap-file.c @@ -131,6 +131,11 @@ void TmModuleDecodePcapFileRegister (void) tmm_modules[TMM_DECODEPCAPFILE].flags = TM_FLAG_DECODE_TM; } +void PcapFileGlobalInit() +{ + SC_ATOMIC_INIT(pcap_g.invalid_checksums); +} + void PcapFileCallbackLoop(char *user, struct pcap_pkthdr *h, u_char *pkt) { SCEnter(); diff --git a/src/source-pcap-file.h b/src/source-pcap-file.h index 636cbdeb6d..fa76a1a8f8 100644 --- a/src/source-pcap-file.h +++ b/src/source-pcap-file.h @@ -29,5 +29,7 @@ void TmModuleDecodePcapFileRegister (void); void PcapIncreaseInvalidChecksum(); +void PcapFileGlobalInit(); + #endif /* __SOURCE_PCAP_FILE_H__ */