packet-logger: remove ThreadExitPrintStats

The ThreadExitPrintStats callback was never being used, remove.

Ticket: #7227
pull/11689/head
Jason Ish 1 year ago committed by Victor Julien
parent cdcb395142
commit 8735c02995

@ -93,8 +93,9 @@ static TmEcode ThreadDeinit(ThreadVars *tv, void *data)
static void Init(void) static void Init(void)
{ {
OutputRegisterPacketLogger(LOGGER_USER, "custom-packet-logger", CustomPacketLogger, OutputRegisterPacketLogger(LOGGER_USER, "custom-packet-logger", CustomPacketLogger,
CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit, NULL); CustomPacketLoggerCondition, NULL, ThreadInit, ThreadDeinit);
OutputRegisterFlowLogger("custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit); OutputRegisterFlowLogger(
"custom-flow-logger", CustomFlowLogger, NULL, ThreadInit, ThreadDeinit);
} }
const SCPlugin PluginRegistration = { const SCPlugin PluginRegistration = {

@ -484,7 +484,7 @@ static int AlertDebugLogLogger(ThreadVars *tv, void *thread_data, const Packet *
void AlertDebugLogRegister(void) void AlertDebugLogRegister(void)
{ {
OutputRegisterPacketModule(LOGGER_ALERT_DEBUG, MODULE_NAME, "alert-debug", OutputRegisterPacketModule(LOGGER_ALERT_DEBUG, MODULE_NAME, "alert-debug", AlertDebugLogInitCtx,
AlertDebugLogInitCtx, AlertDebugLogLogger, AlertDebugLogCondition, AlertDebugLogLogger, AlertDebugLogCondition, AlertDebugLogThreadInit,
AlertDebugLogThreadInit, AlertDebugLogThreadDeinit, NULL); AlertDebugLogThreadDeinit);
} }

@ -76,9 +76,9 @@ int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p);
void AlertFastLogRegister(void) void AlertFastLogRegister(void)
{ {
OutputRegisterPacketModule(LOGGER_ALERT_FAST, MODULE_NAME, "fast", OutputRegisterPacketModule(LOGGER_ALERT_FAST, MODULE_NAME, "fast", AlertFastLogInitCtx,
AlertFastLogInitCtx, AlertFastLogger, AlertFastLogCondition, AlertFastLogger, AlertFastLogCondition, AlertFastLogThreadInit,
AlertFastLogThreadInit, AlertFastLogThreadDeinit, NULL); AlertFastLogThreadDeinit);
AlertFastLogRegisterTests(); AlertFastLogRegisterTests();
} }

@ -384,8 +384,8 @@ static int AlertSyslogLogger(ThreadVars *tv, void *thread_data, const Packet *p)
void AlertSyslogRegister (void) void AlertSyslogRegister (void)
{ {
#ifndef OS_WIN32 #ifndef OS_WIN32
OutputRegisterPacketModule(LOGGER_ALERT_SYSLOG, MODULE_NAME, "syslog", OutputRegisterPacketModule(LOGGER_ALERT_SYSLOG, MODULE_NAME, "syslog", AlertSyslogInitCtx,
AlertSyslogInitCtx, AlertSyslogLogger, AlertSyslogCondition, AlertSyslogLogger, AlertSyslogCondition, AlertSyslogThreadInit,
AlertSyslogThreadInit, AlertSyslogThreadDeinit, NULL); AlertSyslogThreadDeinit);
#endif /* !OS_WIN32 */ #endif /* !OS_WIN32 */
} }

@ -209,9 +209,8 @@ static bool PcapLogCondition(ThreadVars *, void *, const Packet *);
void PcapLogRegister(void) void PcapLogRegister(void)
{ {
OutputRegisterPacketModule(LOGGER_PCAP, MODULE_NAME, "pcap-log", OutputRegisterPacketModule(LOGGER_PCAP, MODULE_NAME, "pcap-log", PcapLogInitCtx, PcapLog,
PcapLogInitCtx, PcapLog, PcapLogCondition, PcapLogDataInit, PcapLogCondition, PcapLogDataInit, PcapLogDataDeinit);
PcapLogDataDeinit, NULL);
PcapLogProfileSetup(); PcapLogProfileSetup();
SC_ATOMIC_INIT(thread_cnt); SC_ATOMIC_INIT(thread_cnt);
SC_ATOMIC_SET(thread_cnt, 1); /* first id is 1 */ SC_ATOMIC_SET(thread_cnt, 1); /* first id is 1 */

@ -453,5 +453,5 @@ void EveStreamLogRegister(void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream", OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream",
EveStreamLogInitCtxSub, EveStreamLogger, EveStreamLogCondition, EveStreamLogThreadInit, EveStreamLogInitCtxSub, EveStreamLogger, EveStreamLogCondition, EveStreamLogThreadInit,
EveStreamLogThreadDeinit, NULL); EveStreamLogThreadDeinit);
} }

@ -1024,8 +1024,7 @@ error:
void JsonAlertLogRegister (void) void JsonAlertLogRegister (void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_ALERT, "eve-log", MODULE_NAME, OutputRegisterPacketSubModule(LOGGER_JSON_ALERT, "eve-log", MODULE_NAME, "eve-log.alert",
"eve-log.alert", JsonAlertLogInitCtxSub, JsonAlertLogger, JsonAlertLogInitCtxSub, JsonAlertLogger, JsonAlertLogCondition, JsonAlertLogThreadInit,
JsonAlertLogCondition, JsonAlertLogThreadInit, JsonAlertLogThreadDeinit, JsonAlertLogThreadDeinit);
NULL);
} }

@ -450,10 +450,9 @@ static OutputInitResult JsonAnomalyLogInitCtxSub(ConfNode *conf, OutputCtx *pare
void JsonAnomalyLogRegister (void) void JsonAnomalyLogRegister (void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, OutputRegisterPacketSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, "eve-log.anomaly",
"eve-log.anomaly", JsonAnomalyLogInitCtxSub, JsonAnomalyLogger, JsonAnomalyLogInitCtxSub, JsonAnomalyLogger, JsonAnomalyLogCondition,
JsonAnomalyLogCondition, JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit, JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit);
NULL);
OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME,
"eve-log.anomaly", JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN, "eve-log.anomaly", JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN,

@ -105,7 +105,7 @@ void JsonArpLogRegister(void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_ARP, "eve-log", "JsonArpLog", "eve-log.arp", OutputRegisterPacketSubModule(LOGGER_JSON_ARP, "eve-log", "JsonArpLog", "eve-log.arp",
OutputJsonLogInitSub, JsonArpLogger, JsonArpLogCondition, JsonLogThreadInit, OutputJsonLogInitSub, JsonArpLogger, JsonArpLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL); JsonLogThreadDeinit);
SCLogDebug("ARP JSON logger registered."); SCLogDebug("ARP JSON logger registered.");
} }

@ -390,8 +390,7 @@ static bool JsonDropLogCondition(ThreadVars *tv, void *data, const Packet *p)
void JsonDropLogRegister (void) void JsonDropLogRegister (void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_DROP, "eve-log", MODULE_NAME, OutputRegisterPacketSubModule(LOGGER_JSON_DROP, "eve-log", MODULE_NAME, "eve-log.drop",
"eve-log.drop", JsonDropLogInitCtxSub, JsonDropLogger, JsonDropLogInitCtxSub, JsonDropLogger, JsonDropLogCondition, JsonDropLogThreadInit,
JsonDropLogCondition, JsonDropLogThreadInit, JsonDropLogThreadDeinit, JsonDropLogThreadDeinit);
NULL);
} }

@ -560,5 +560,5 @@ void JsonFrameLogRegister(void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_FRAME, "eve-log", MODULE_NAME, "eve-log.frame", OutputRegisterPacketSubModule(LOGGER_JSON_FRAME, "eve-log", MODULE_NAME, "eve-log.frame",
JsonFrameLogInitCtxSub, JsonFrameLogger, JsonFrameLogCondition, JsonFrameLogThreadInit, JsonFrameLogInitCtxSub, JsonFrameLogger, JsonFrameLogCondition, JsonFrameLogThreadInit,
JsonFrameLogThreadDeinit, NULL); JsonFrameLogThreadDeinit);
} }

@ -96,10 +96,10 @@ void JsonMetadataLogRegister (void)
{ {
OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.metadata", OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.metadata",
OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit, OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL); JsonLogThreadDeinit);
/* Kept for compatibility. */ /* Kept for compatibility. */
OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.vars", OutputRegisterPacketSubModule(LOGGER_JSON_METADATA, "eve-log", MODULE_NAME, "eve-log.vars",
OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit, OutputJsonLogInitSub, JsonMetadataLogger, JsonMetadataLogCondition, JsonLogThreadInit,
JsonLogThreadDeinit, NULL); JsonLogThreadDeinit);
} }

@ -48,14 +48,13 @@ typedef struct OutputPacketLogger_ {
LoggerId logger_id; LoggerId logger_id;
ThreadInitFunc ThreadInit; ThreadInitFunc ThreadInit;
ThreadDeinitFunc ThreadDeinit; ThreadDeinitFunc ThreadDeinit;
ThreadExitPrintStatsFunc ThreadExitPrintStats;
} OutputPacketLogger; } OutputPacketLogger;
static OutputPacketLogger *list = NULL; static OutputPacketLogger *list = NULL;
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc, int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc ThreadInit, PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats) ThreadDeinitFunc ThreadDeinit)
{ {
OutputPacketLogger *op = SCCalloc(1, sizeof(*op)); OutputPacketLogger *op = SCCalloc(1, sizeof(*op));
if (op == NULL) if (op == NULL)
@ -67,7 +66,6 @@ int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogge
op->name = name; op->name = name;
op->ThreadInit = ThreadInit; op->ThreadInit = ThreadInit;
op->ThreadDeinit = ThreadDeinit; op->ThreadDeinit = ThreadDeinit;
op->ThreadExitPrintStats = ThreadExitPrintStats;
op->logger_id = logger_id; op->logger_id = logger_id;
if (list == NULL) if (list == NULL)
@ -184,22 +182,6 @@ static TmEcode OutputPacketLogThreadDeinit(ThreadVars *tv, void *thread_data)
return TM_ECODE_OK; return TM_ECODE_OK;
} }
static void OutputPacketLogExitPrintStats(ThreadVars *tv, void *thread_data)
{
OutputPacketLoggerThreadData *op_thread_data = (OutputPacketLoggerThreadData *)thread_data;
OutputLoggerThreadStore *store = op_thread_data->store;
OutputPacketLogger *logger = list;
while (logger && store) {
if (logger->ThreadExitPrintStats) {
logger->ThreadExitPrintStats(tv, store->thread_data);
}
logger = logger->next;
store = store->next;
}
}
static uint32_t OutputPacketLoggerGetActiveCount(void) static uint32_t OutputPacketLoggerGetActiveCount(void)
{ {
uint32_t cnt = 0; uint32_t cnt = 0;
@ -211,9 +193,8 @@ static uint32_t OutputPacketLoggerGetActiveCount(void)
void OutputPacketLoggerRegister(void) void OutputPacketLoggerRegister(void)
{ {
OutputRegisterRootLogger(OutputPacketLogThreadInit, OutputRegisterRootLogger(OutputPacketLogThreadInit, OutputPacketLogThreadDeinit, NULL,
OutputPacketLogThreadDeinit, OutputPacketLogExitPrintStats, OutputPacketLog, OutputPacketLoggerGetActiveCount);
OutputPacketLog, OutputPacketLoggerGetActiveCount);
} }
void OutputPacketShutdown(void) void OutputPacketShutdown(void)

@ -38,8 +38,7 @@ typedef int (*PacketLogger)(ThreadVars *, void *thread_data, const Packet *);
typedef bool (*PacketLogCondition)(ThreadVars *, void *thread_data, const Packet *); typedef bool (*PacketLogCondition)(ThreadVars *, void *thread_data, const Packet *);
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc, int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc,
PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc, ThreadDeinitFunc, PacketLogCondition ConditionFunc, void *initdata, ThreadInitFunc, ThreadDeinitFunc);
ThreadExitPrintStatsFunc);
void OutputPacketLoggerRegister(void); void OutputPacketLoggerRegister(void);

@ -167,11 +167,9 @@ error:
* *
* \retval Returns 0 on success, -1 on failure. * \retval Returns 0 on success, -1 on failure.
*/ */
void OutputRegisterPacketModule(LoggerId id, const char *name, void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name,
const char *conf_name, OutputInitFunc InitFunc, OutputInitFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc,
PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{ {
if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) { if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
goto error; goto error;
@ -190,7 +188,6 @@ void OutputRegisterPacketModule(LoggerId id, const char *name,
module->PacketConditionFunc = PacketConditionFunc; module->PacketConditionFunc = PacketConditionFunc;
module->ThreadInit = ThreadInit; module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit; module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries); TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Packet logger \"%s\" registered.", name); SCLogDebug("Packet logger \"%s\" registered.", name);
@ -207,11 +204,10 @@ error:
* *
* \retval Returns 0 on success, -1 on failure. * \retval Returns 0 on success, -1 on failure.
*/ */
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger PacketLogFunc,
PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadDeinitFunc ThreadDeinit)
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{ {
if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) { if (unlikely(PacketLogFunc == NULL || PacketConditionFunc == NULL)) {
goto error; goto error;
@ -231,7 +227,6 @@ void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name,
module->PacketConditionFunc = PacketConditionFunc; module->PacketConditionFunc = PacketConditionFunc;
module->ThreadInit = ThreadInit; module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit; module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries); TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Packet logger \"%s\" registered.", name); SCLogDebug("Packet logger \"%s\" registered.", name);

@ -87,15 +87,12 @@ extern OutputModuleList output_modules;
void OutputRegisterModule(const char *, const char *, OutputInitFunc); void OutputRegisterModule(const char *, const char *, OutputInitFunc);
void OutputRegisterPacketModule(LoggerId id, const char *name, void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name,
const char *conf_name, OutputInitFunc InitFunc, PacketLogger LogFunc, OutputInitFunc InitFunc, PacketLogger LogFunc, PacketLogCondition ConditionFunc,
PacketLogCondition ConditionFunc, ThreadInitFunc, ThreadDeinitFunc, ThreadInitFunc, ThreadDeinitFunc);
ThreadExitPrintStatsFunc); void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name,
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger LogFunc,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogCondition ConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
PacketLogger LogFunc, PacketLogCondition ConditionFunc,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats);
void OutputRegisterTxModule(LoggerId id, const char *name, void OutputRegisterTxModule(LoggerId id, const char *name,
const char *conf_name, OutputInitFunc InitFunc, AppProto alproto, const char *conf_name, OutputInitFunc InitFunc, AppProto alproto,

@ -620,8 +620,7 @@ static void SetupOutput(
SCLogDebug("%s is a packet logger", module->name); SCLogDebug("%s is a packet logger", module->name);
OutputRegisterPacketLogger(module->logger_id, module->name, OutputRegisterPacketLogger(module->logger_id, module->name,
module->PacketLogFunc, module->PacketConditionFunc, output_ctx, module->PacketLogFunc, module->PacketConditionFunc, output_ctx,
module->ThreadInit, module->ThreadDeinit, module->ThreadInit, module->ThreadDeinit);
module->ThreadExitPrintStats);
} else if (module->TxLogFunc) { } else if (module->TxLogFunc) {
SCLogDebug("%s is a tx logger", module->name); SCLogDebug("%s is a tx logger", module->name);
OutputRegisterTxLogger(module->logger_id, module->name, module->alproto, OutputRegisterTxLogger(module->logger_id, module->name, module->alproto,

Loading…
Cancel
Save