counters: work around unix-socket init issues

pull/1508/head
Victor Julien 11 years ago
parent e48153c6b0
commit cb5aa8f8d5

@ -358,10 +358,6 @@ void RegisterDNSUDPParsers(void)
{ {
char *proto_name = "dns"; char *proto_name = "dns";
StatsRegisterGlobalCounter("dns.memuse", DNSMemcapGetMemuseCounter);
StatsRegisterGlobalCounter("dns.memcap_state", DNSMemcapGetMemcapStateCounter);
StatsRegisterGlobalCounter("dns.memcap_global", DNSMemcapGetMemcapGlobalCounter);
/** DNS */ /** DNS */
if (AppLayerProtoDetectConfProtoDetectionEnabled("udp", proto_name)) { if (AppLayerProtoDetectConfProtoDetectionEnabled("udp", proto_name)) {
AppLayerProtoDetectRegisterProtocol(ALPROTO_DNS, proto_name); AppLayerProtoDetectRegisterProtocol(ALPROTO_DNS, proto_name);

@ -2547,9 +2547,6 @@ void HTPConfigure(void)
HTPConfigSetDefaultsPhase2(s->name, htprec); HTPConfigSetDefaultsPhase2(s->name, htprec);
} }
StatsRegisterGlobalCounter("http.memuse", HTPMemuseGlobalCounter);
StatsRegisterGlobalCounter("http.memcap", HTPMemcapGlobalCounter);
SCReturn; SCReturn;
} }

@ -609,6 +609,17 @@ void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *p)
PACKET_PROFILING_APP_STORE(app_tctx, p); PACKET_PROFILING_APP_STORE(app_tctx, p);
} }
/** \brief HACK to work around our broken unix manager (re)init loop
*/
void AppLayerRegisterGlobalCounters(void)
{
StatsRegisterGlobalCounter("dns.memuse", DNSMemcapGetMemuseCounter);
StatsRegisterGlobalCounter("dns.memcap_state", DNSMemcapGetMemcapStateCounter);
StatsRegisterGlobalCounter("dns.memcap_global", DNSMemcapGetMemcapGlobalCounter);
StatsRegisterGlobalCounter("http.memuse", HTPMemuseGlobalCounter);
StatsRegisterGlobalCounter("http.memcap", HTPMemcapGlobalCounter);
}
/***** Unittests *****/ /***** Unittests *****/
#ifdef UNITTESTS #ifdef UNITTESTS

@ -130,6 +130,7 @@ static inline void AppLayerProfilingStore(AppLayerThreadCtx *app_tctx, Packet *p
#endif #endif
} }
void AppLayerRegisterGlobalCounters(void);
/***** Unittests *****/ /***** Unittests *****/

@ -37,6 +37,7 @@
#include "host.h" #include "host.h"
#include "defrag.h" #include "defrag.h"
#include "ippair.h" #include "ippair.h"
#include "app-layer.h"
#include "util-profiling.h" #include "util-profiling.h"
@ -354,6 +355,7 @@ TmEcode UnixSocketPcapFilesCheck(void *data)
FlowInitConfig(FLOW_QUIET); FlowInitConfig(FLOW_QUIET);
IPPairInitConfig(FLOW_QUIET); IPPairInitConfig(FLOW_QUIET);
StreamTcpInitConfig(STREAM_VERBOSE); StreamTcpInitConfig(STREAM_VERBOSE);
AppLayerRegisterGlobalCounters();
RunModeInitializeOutputs(); RunModeInitializeOutputs();
StatsSetupPostConfig(); StatsSetupPostConfig();
RunModeDispatch(RUNMODE_PCAP_FILE, NULL); RunModeDispatch(RUNMODE_PCAP_FILE, NULL);

@ -2206,7 +2206,9 @@ int main(int argc, char **argv)
GlobalInits(); GlobalInits();
TimeInit(); TimeInit();
SupportFastPatternForSigMatchTypes(); SupportFastPatternForSigMatchTypes();
if (suri.run_mode != RUNMODE_UNIX_SOCKET) {
StatsInit(); StatsInit();
}
if (conf_filename == NULL) if (conf_filename == NULL)
conf_filename = DEFAULT_CONF_FILE; conf_filename = DEFAULT_CONF_FILE;
@ -2256,6 +2258,7 @@ int main(int argc, char **argv)
FlowInitConfig(FLOW_VERBOSE); FlowInitConfig(FLOW_VERBOSE);
StreamTcpInitConfig(STREAM_VERBOSE); StreamTcpInitConfig(STREAM_VERBOSE);
IPPairInitConfig(IPPAIR_VERBOSE); IPPairInitConfig(IPPAIR_VERBOSE);
AppLayerRegisterGlobalCounters();
} }
if (MagicInit() != 0) if (MagicInit() != 0)

Loading…
Cancel
Save