counters: work around unix-socket init issues

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

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

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

@ -609,6 +609,17 @@ void AppLayerProfilingStoreInternal(AppLayerThreadCtx *app_tctx, Packet *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 *****/
#ifdef UNITTESTS

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

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

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

Loading…
Cancel
Save