From: Jason Ish Date: Mon, 20 Jun 2016 15:52:28 +0000 (-0600) Subject: logging: hook into flow worker thread X-Git-Tag: suricata-3.2beta1~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00b6e628d17f16789bfba1c4e8ca3029cef4f021;p=thirdparty%2Fsuricata.git logging: hook into flow worker thread --- diff --git a/src/alert-debuglog.c b/src/alert-debuglog.c index 1f2f5a4553..267b8eb811 100644 --- a/src/alert-debuglog.c +++ b/src/alert-debuglog.c @@ -216,7 +216,6 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da if (p->flow != NULL) { int applayer = 0; - FLOWLOCK_RDLOCK(p->flow); applayer = StreamTcpAppLayerIsDisabled(p->flow); CreateTimeString(&p->flow->startts, timebuf, sizeof(timebuf)); MemBufferWriteString(aft->buffer, "FLOW Start TS: %s\n", timebuf); @@ -239,7 +238,6 @@ static TmEcode AlertDebugLogger(ThreadVars *tv, const Packet *p, void *thread_da (p->flow->alproto != ALPROTO_UNKNOWN) ? "TRUE" : "FALSE", p->flow->alproto); AlertDebugLogFlowVars(aft, p); AlertDebugLogFlowBits(aft, (Packet *)p); /* < no const */ - FLOWLOCK_UNLOCK(p->flow); } AlertDebugLogPktVars(aft, p); diff --git a/src/alert-unified2-alert.c b/src/alert-unified2-alert.c index be0998edfc..b922fe8f5e 100644 --- a/src/alert-unified2-alert.c +++ b/src/alert-unified2-alert.c @@ -331,11 +331,9 @@ int Unified2Logger(ThreadVars *t, void *data, const Packet *p) char buffer[XFF_MAXLEN]; int have_xff_ip = 0; - FLOWLOCK_RDLOCK(p->flow); if (FlowGetAppProtocol(p->flow) == ALPROTO_HTTP) { have_xff_ip = HttpXFFGetIP(p, xff_cfg, buffer, XFF_MAXLEN); } - FLOWLOCK_UNLOCK(p->flow); if (have_xff_ip) { /** Be sure that we have a nice zeroed buffer */ @@ -890,7 +888,6 @@ static int Unified2IPv6TypeAlert(ThreadVars *t, const Packet *p, void *data) char buffer[XFF_MAXLEN]; int have_xff_ip = 0; - FLOWLOCK_RDLOCK(p->flow); if (FlowGetAppProtocol(p->flow) == ALPROTO_HTTP) { if (pa->flags & PACKET_ALERT_FLAG_TX) { have_xff_ip = HttpXFFGetIPFromTx(p, pa->tx_id, xff_cfg, buffer, XFF_MAXLEN); @@ -898,7 +895,6 @@ static int Unified2IPv6TypeAlert(ThreadVars *t, const Packet *p, void *data) have_xff_ip = HttpXFFGetIP(p, xff_cfg, buffer, XFF_MAXLEN); } } - FLOWLOCK_UNLOCK(p->flow); if (have_xff_ip) { memset(aun->xff_ip, 0, 4 * sizeof(uint32_t)); @@ -1067,7 +1063,6 @@ static int Unified2IPv4TypeAlert (ThreadVars *tv, const Packet *p, void *data) char buffer[XFF_MAXLEN]; int have_xff_ip = 0; - FLOWLOCK_RDLOCK(p->flow); if (FlowGetAppProtocol(p->flow) == ALPROTO_HTTP) { if (pa->flags & PACKET_ALERT_FLAG_TX) { have_xff_ip = HttpXFFGetIPFromTx(p, pa->tx_id, xff_cfg, buffer, XFF_MAXLEN); @@ -1075,7 +1070,6 @@ static int Unified2IPv4TypeAlert (ThreadVars *tv, const Packet *p, void *data) have_xff_ip = HttpXFFGetIP(p, xff_cfg, buffer, XFF_MAXLEN); } } - FLOWLOCK_UNLOCK(p->flow); if (have_xff_ip) { memset(aun->xff_ip, 0, 4 * sizeof(uint32_t)); diff --git a/src/flow-worker.c b/src/flow-worker.c index 154b3948f3..2d981e4be7 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -29,12 +29,6 @@ * - Detection * * This all while holding the flow lock. - * - * TODO - * - once we have a single entry point into the outputs they - * will have to move into this as well. - * - once outputs are here we can also call StreamTcpPrune here - * instead of in the packet pool return code */ #include "suricata-common.h" @@ -44,6 +38,7 @@ #include "stream-tcp.h" #include "app-layer.h" #include "detect-engine.h" +#include "output.h" #include "util-validate.h" @@ -59,9 +54,8 @@ typedef struct FlowWorkerThreadData_ { SC_ATOMIC_DECLARE(DetectEngineThreadCtxPtr, detect_thread); -#if 0 - void *output_thread; // XXX multiple, not a single state -#endif + void *output_thread; /* Output thread data. */ + PacketQueue pq; } FlowWorkerThreadData; @@ -98,9 +92,9 @@ static TmEcode FlowWorkerThreadInit(ThreadVars *tv, void *initdata, void **data) BUG_ON(DetectEngineThreadCtxInit(tv, NULL, &detect_thread) != TM_ECODE_OK); SC_ATOMIC_SET(fw->detect_thread, detect_thread); } -#if 0 - // setup OUTPUTS -#endif + + /* Setup outputs for this thread. */ + OutputLoggerThreadInit(tv, initdata, &fw->output_thread); /* setup pq for stream end pkts */ memset(&fw->pq, 0, sizeof(PacketQueue)); @@ -125,9 +119,9 @@ static TmEcode FlowWorkerThreadDeinit(ThreadVars *tv, void *data) DetectEngineThreadCtxDeinit(tv, detect_thread); SC_ATOMIC_SET(fw->detect_thread, NULL); } -#if 0 - // free OUTPUT -#endif + + /* Free output. */ + OutputLoggerThreadDeinit(tv, fw->output_thread); /* free pq */ BUG_ON(fw->pq.len); @@ -195,9 +189,10 @@ TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data, PacketQueue *preq, Pac Detect(tv, x, detect_thread, NULL, NULL); FLOWWORKER_PROFILING_END(x, PROFILE_FLOWWORKER_DETECT); } -#if 0 + // Outputs -#endif + OutputLoggerLog(tv, x, fw->output_thread, preq, unused); + /* put these packets in the preq queue so that they are * by the other thread modules before packet 'p'. */ PacketEnqueue(preq, x); @@ -219,11 +214,15 @@ TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data, PacketQueue *preq, Pac Detect(tv, p, detect_thread, NULL, NULL); FLOWWORKER_PROFILING_END(p, PROFILE_FLOWWORKER_DETECT); } -#if 0 - // Outputs - // StreamTcpPruneSession (from TmqhOutputPacketpool) -#endif + // Outputs. + OutputLoggerLog(tv, p, fw->output_thread, preq, unused); + + /* Release tcp segments. Done here after alerting can use them. */ + if (p->flow != NULL && p->proto == IPPROTO_TCP) { + StreamTcpPruneSession(p->flow, p->flowflags & FLOW_PKT_TOSERVER ? + STREAM_TOSERVER : STREAM_TOCLIENT); + } if (p->flow) { DEBUG_ASSERT_FLOW_LOCKED(p->flow); @@ -264,6 +263,11 @@ const char *ProfileFlowWorkerIdToString(enum ProfileFlowWorkerId fwi) return "error"; } +static void FlowWorkerExitPrintStats(ThreadVars *tv, void *data) +{ + FlowWorkerThreadData *fw = data; + OutputLoggerExitPrintStats(tv, fw->output_thread); +} void TmModuleFlowWorkerRegister (void) { @@ -271,6 +275,7 @@ void TmModuleFlowWorkerRegister (void) tmm_modules[TMM_FLOWWORKER].ThreadInit = FlowWorkerThreadInit; tmm_modules[TMM_FLOWWORKER].Func = FlowWorker; tmm_modules[TMM_FLOWWORKER].ThreadDeinit = FlowWorkerThreadDeinit; + tmm_modules[TMM_FLOWWORKER].ThreadExitPrintStats = FlowWorkerExitPrintStats; tmm_modules[TMM_FLOWWORKER].cap_flags = 0; tmm_modules[TMM_FLOWWORKER].flags = TM_FLAG_STREAM_TM|TM_FLAG_DETECT_TM; } diff --git a/src/log-droplog.c b/src/log-droplog.c index ea0158388a..027425754d 100644 --- a/src/log-droplog.c +++ b/src/log-droplog.c @@ -292,14 +292,12 @@ static int LogDropCondition(ThreadVars *tv, const Packet *p) if (p->flow != NULL) { int ret = FALSE; - FLOWLOCK_RDLOCK(p->flow); if (p->flow->flags & FLOW_ACTION_DROP) { if (PKT_IS_TOSERVER(p) && !(p->flow->flags & FLOW_TOSERVER_DROP_LOGGED)) ret = TRUE; else if (PKT_IS_TOCLIENT(p) && !(p->flow->flags & FLOW_TOCLIENT_DROP_LOGGED)) ret = TRUE; } - FLOWLOCK_UNLOCK(p->flow); return ret; } else if (PACKET_TEST_ACTION(p, ACTION_DROP)) { return TRUE; @@ -325,14 +323,12 @@ static int LogDropLogger(ThreadVars *tv, void *thread_data, const Packet *p) return -1; if (p->flow) { - FLOWLOCK_RDLOCK(p->flow); if (p->flow->flags & FLOW_ACTION_DROP) { if (PKT_IS_TOSERVER(p) && !(p->flow->flags & FLOW_TOSERVER_DROP_LOGGED)) p->flow->flags |= FLOW_TOSERVER_DROP_LOGGED; else if (PKT_IS_TOCLIENT(p) && !(p->flow->flags & FLOW_TOCLIENT_DROP_LOGGED)) p->flow->flags |= FLOW_TOCLIENT_DROP_LOGGED; } - FLOWLOCK_UNLOCK(p->flow); } return 0; } diff --git a/src/output-file.c b/src/output-file.c index 78b9df38f2..402b398ab0 100644 --- a/src/output-file.c +++ b/src/output-file.c @@ -123,7 +123,6 @@ static TmEcode OutputFileLog(ThreadVars *tv, Packet *p, void *thread_data, Packe int file_close = (p->flags & PKT_PSEUDO_STREAM_END) ? 1 : 0; int file_trunc = 0; - FLOWLOCK_WRLOCK(f); // < need write lock for FilePrune below file_trunc = StreamTcpReassembleDepthReached(p); FileContainer *ffc = AppLayerParserGetFiles(p->proto, f->alproto, @@ -180,7 +179,6 @@ static TmEcode OutputFileLog(ThreadVars *tv, Packet *p, void *thread_data, Packe FilePrune(ffc); } - FLOWLOCK_UNLOCK(f); return TM_ECODE_OK; } diff --git a/src/output-filedata.c b/src/output-filedata.c index 7b7ea20a23..589bef6893 100644 --- a/src/output-filedata.c +++ b/src/output-filedata.c @@ -157,7 +157,6 @@ static TmEcode OutputFiledataLog(ThreadVars *tv, Packet *p, void *thread_data, P int file_close = (p->flags & PKT_PSEUDO_STREAM_END) ? 1 : 0; int file_trunc = 0; - FLOWLOCK_WRLOCK(f); // < need write lock for FiledataPrune below file_trunc = StreamTcpReassembleDepthReached(p); FileContainer *ffc = AppLayerParserGetFiles(p->proto, f->alproto, @@ -234,7 +233,6 @@ static TmEcode OutputFiledataLog(ThreadVars *tv, Packet *p, void *thread_data, P FilePrune(ffc); } - FLOWLOCK_UNLOCK(f); return TM_ECODE_OK; } diff --git a/src/output-json-alert.c b/src/output-json-alert.c index 0de310b58e..6823774487 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -221,7 +221,6 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) if (json_output_ctx->flags & LOG_JSON_HTTP) { if (p->flow != NULL) { - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); /* http alert */ @@ -230,40 +229,31 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) if (hjs) json_object_set_new(js, "http", hjs); } - - FLOWLOCK_UNLOCK(p->flow); } } if (json_output_ctx->flags & LOG_JSON_TLS) { if (p->flow != NULL) { - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); /* http alert */ if (proto == ALPROTO_TLS) AlertJsonTls(p->flow, js); - - FLOWLOCK_UNLOCK(p->flow); } } if (json_output_ctx->flags & LOG_JSON_SSH) { if (p->flow != NULL) { - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); /* http alert */ if (proto == ALPROTO_SSH) AlertJsonSsh(p->flow, js); - - FLOWLOCK_UNLOCK(p->flow); } } if (json_output_ctx->flags & LOG_JSON_SMTP) { if (p->flow != NULL) { - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); /* http alert */ @@ -276,8 +266,6 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) if (hjs) json_object_set_new(js, "email", hjs); } - - FLOWLOCK_UNLOCK(p->flow); } } @@ -353,7 +341,6 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) int have_xff_ip = 0; char buffer[XFF_MAXLEN]; - FLOWLOCK_RDLOCK(p->flow); if (FlowGetAppProtocol(p->flow) == ALPROTO_HTTP) { if (pa->flags & PACKET_ALERT_FLAG_TX) { have_xff_ip = HttpXFFGetIPFromTx(p, pa->tx_id, xff_cfg, buffer, XFF_MAXLEN); @@ -361,7 +348,6 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) have_xff_ip = HttpXFFGetIP(p, xff_cfg, buffer, XFF_MAXLEN); } } - FLOWLOCK_UNLOCK(p->flow); if (have_xff_ip) { if (xff_cfg->flags & XFF_EXTRADATA) { diff --git a/src/output-json-drop.c b/src/output-json-drop.c index 8ae8c4297a..66ab32aea9 100644 --- a/src/output-json-drop.c +++ b/src/output-json-drop.c @@ -370,14 +370,12 @@ static int JsonDropLogger(ThreadVars *tv, void *thread_data, const Packet *p) return 0; if (p->flow) { - FLOWLOCK_RDLOCK(p->flow); if (p->flow->flags & FLOW_ACTION_DROP) { if (PKT_IS_TOSERVER(p) && !(p->flow->flags & FLOW_TOSERVER_DROP_LOGGED)) p->flow->flags |= FLOW_TOSERVER_DROP_LOGGED; else if (PKT_IS_TOCLIENT(p) && !(p->flow->flags & FLOW_TOCLIENT_DROP_LOGGED)) p->flow->flags |= FLOW_TOCLIENT_DROP_LOGGED; } - FLOWLOCK_UNLOCK(p->flow); } return 0; } @@ -406,14 +404,12 @@ static int JsonDropLogCondition(ThreadVars *tv, const Packet *p) int ret = FALSE; /* for a flow that will be dropped fully, log just once per direction */ - FLOWLOCK_RDLOCK(p->flow); if (p->flow->flags & FLOW_ACTION_DROP) { if (PKT_IS_TOSERVER(p) && !(p->flow->flags & FLOW_TOSERVER_DROP_LOGGED)) ret = TRUE; else if (PKT_IS_TOCLIENT(p) && !(p->flow->flags & FLOW_TOCLIENT_DROP_LOGGED)) ret = TRUE; } - FLOWLOCK_UNLOCK(p->flow); /* if drop is caused by signature, log anyway */ if (p->alerts.drop.action != 0) diff --git a/src/output-json-ssh.c b/src/output-json-ssh.c index e8178f3152..2b0ac7f99c 100644 --- a/src/output-json-ssh.c +++ b/src/output-json-ssh.c @@ -99,7 +99,6 @@ static int JsonSshLogger(ThreadVars *tv, void *thread_data, const Packet *p) } /* check if we have SSH state or not */ - FLOWLOCK_WRLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); if (proto != ALPROTO_SSH) goto end; @@ -136,7 +135,6 @@ static int JsonSshLogger(ThreadVars *tv, void *thread_data, const Packet *p) /* we only log the state once */ ssh_state->cli_hdr.flags |= SSH_FLAG_STATE_LOGGED; end: - FLOWLOCK_UNLOCK(p->flow); return 0; } @@ -286,7 +284,6 @@ static int JsonSshCondition(ThreadVars *tv, const Packet *p) return FALSE; } - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); if (proto != ALPROTO_SSH) goto dontlog; @@ -307,10 +304,8 @@ static int JsonSshCondition(ThreadVars *tv, const Packet *p) /* todo: logic to log once */ - FLOWLOCK_UNLOCK(p->flow); return TRUE; dontlog: - FLOWLOCK_UNLOCK(p->flow); return FALSE; } diff --git a/src/output-lua.c b/src/output-lua.c index deed5d5bc9..1bd1aae695 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -266,13 +266,11 @@ static int LuaPacketLoggerSsh(ThreadVars *tv, void *thread_data, const Packet *p } SCMutexUnlock(&td->lua_ctx->m); - FLOWLOCK_WRLOCK(p->flow); SshState *ssh_state = (SshState *)FlowGetAppState(p->flow); if (ssh_state != NULL) ssh_state->cli_hdr.flags |= SSH_FLAG_STATE_LOGGED_LUA; - FLOWLOCK_UNLOCK(p->flow); SCReturnInt(0); } @@ -290,7 +288,6 @@ static int LuaPacketConditionSsh(ThreadVars *tv, const Packet *p) return FALSE; } - FLOWLOCK_RDLOCK(p->flow); uint16_t proto = FlowGetAppProtocol(p->flow); if (proto != ALPROTO_SSH) goto dontlog; @@ -309,10 +306,8 @@ static int LuaPacketConditionSsh(ThreadVars *tv, const Packet *p) if (ssh_state->cli_hdr.flags & SSH_FLAG_STATE_LOGGED_LUA) goto dontlog; - FLOWLOCK_UNLOCK(p->flow); return TRUE; dontlog: - FLOWLOCK_UNLOCK(p->flow); return FALSE; } diff --git a/src/output-streaming.c b/src/output-streaming.c index 6c8e5a066f..1300295700 100644 --- a/src/output-streaming.c +++ b/src/output-streaming.c @@ -330,8 +330,6 @@ static TmEcode OutputStreamingLog(ThreadVars *tv, Packet *p, void *thread_data, else flags |= OUTPUT_STREAMING_FLAG_TOSERVER; - FLOWLOCK_WRLOCK(f); - if (op_thread_data->loggers & (1<protoctx; if (ssn) { @@ -359,7 +357,6 @@ static TmEcode OutputStreamingLog(ThreadVars *tv, Packet *p, void *thread_data, } } - FLOWLOCK_UNLOCK(f); return TM_ECODE_OK; } diff --git a/src/output-tx.c b/src/output-tx.c index 004a83adc6..ad24e5cb0c 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -148,7 +148,6 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ Flow * const f = p->flow; - FLOWLOCK_WRLOCK(f); /* WRITE lock before we updated flow logged id */ AppProto alproto = f->alproto; if (AppLayerParserProtocolIsTxAware(p->proto, alproto) == 0) @@ -250,7 +249,6 @@ next: } end: - FLOWLOCK_UNLOCK(f); return TM_ECODE_OK; } diff --git a/src/output.c b/src/output.c index ed714e9023..db742d4136 100644 --- a/src/output.c +++ b/src/output.c @@ -916,7 +916,7 @@ void OutputNotifyFileRotation(void) { } } -static TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data, +TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQueue *pq, PacketQueue *postpq) { LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data; @@ -933,7 +933,7 @@ static TmEcode OutputLoggerLog(ThreadVars *tv, Packet *p, void *thread_data, return TM_ECODE_OK; } -static TmEcode OutputLoggerThreadInit(ThreadVars *tv, void *initdata, +TmEcode OutputLoggerThreadInit(ThreadVars *tv, void *initdata, void **data) { LoggerThreadStore *thread_store = SCCalloc(1, sizeof(*thread_store)); @@ -960,7 +960,7 @@ static TmEcode OutputLoggerThreadInit(ThreadVars *tv, void *initdata, return TM_ECODE_OK; } -static TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data) +TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data) { LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data; RootLogger *logger = TAILQ_FIRST(&RootLoggers); @@ -983,7 +983,7 @@ static TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data) return TM_ECODE_OK; } -static void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data) +void OutputLoggerExitPrintStats(ThreadVars *tv, void *thread_data) { LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data; RootLogger *logger = TAILQ_FIRST(&RootLoggers); @@ -1015,21 +1015,10 @@ void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, void TmModuleLoggerRegister(void) { - tmm_modules[TMM_LOGGER].name = "__root_logger__"; - tmm_modules[TMM_LOGGER].ThreadInit = OutputLoggerThreadInit; - tmm_modules[TMM_LOGGER].ThreadDeinit = OutputLoggerThreadDeinit; - tmm_modules[TMM_LOGGER].ThreadExitPrintStats = OutputLoggerExitPrintStats; - tmm_modules[TMM_LOGGER].Func = OutputLoggerLog;; - OutputRegisterRootLoggers(); OutputRegisterLoggers(); } -void SetupOutputs(ThreadVars *tv) -{ - TmSlotSetFuncAppend(tv, &tmm_modules[TMM_LOGGER], NULL); -} - /** * \brief Register all root loggers. */ diff --git a/src/output.h b/src/output.h index 009d4995be..5d01c904ce 100644 --- a/src/output.h +++ b/src/output.h @@ -42,7 +42,6 @@ typedef OutputCtx *(*OutputInitFunc)(ConfNode *); typedef OutputCtx *(*OutputInitSubFunc)(ConfNode *, OutputCtx *); typedef TmEcode (*OutputLogFunc)(ThreadVars *, Packet *, void *, PacketQueue *, PacketQueue *); - typedef struct OutputModule_ { LoggerId logger_id; const char *name; @@ -197,6 +196,11 @@ void OutputRegisterRootLogger(ThreadInitFunc ThreadInit, ThreadExitPrintStatsFunc ThreadExitPrintStats, OutputLogFunc LogFunc); void TmModuleLoggerRegister(void); -void SetupOutputs(ThreadVars *); + +TmEcode OutputLoggerLog(ThreadVars *, Packet *, void *, PacketQueue *, + PacketQueue *); +TmEcode OutputLoggerThreadInit(ThreadVars *, void *, void **); +TmEcode OutputLoggerThreadDeinit(ThreadVars *, void *); +void OutputLoggerExitPrintStats(ThreadVars *, void *); #endif /* ! __OUTPUT_H__ */ diff --git a/src/runmode-erf-file.c b/src/runmode-erf-file.c index 714f2af156..76bc492147 100644 --- a/src/runmode-erf-file.c +++ b/src/runmode-erf-file.c @@ -101,8 +101,6 @@ int RunModeErfFileSingle(void) } TmSlotSetFuncAppend(tv, tm_module, NULL); - SetupOutputs(tv); - if (TmThreadSpawn(tv) != TM_ECODE_OK) { printf("ERROR: TmThreadSpawn failed\n"); exit(EXIT_FAILURE); @@ -231,9 +229,6 @@ int RunModeErfFileAutoFp(void) TmThreadSetGroupName(tv_detect_ncpu, "Detect"); - /* Add logger. */ - SetupOutputs(tv_detect_ncpu); - if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) { printf("ERROR: TmThreadSpawn failed\n"); exit(EXIT_FAILURE); diff --git a/src/runmode-pcap-file.c b/src/runmode-pcap-file.c index e671a4a7b6..6bf44ae7d5 100644 --- a/src/runmode-pcap-file.c +++ b/src/runmode-pcap-file.c @@ -107,8 +107,6 @@ int RunModeFilePcapSingle(void) } TmSlotSetFuncAppend(tv, tm_module, NULL); - SetupOutputs(tv); - TmThreadSetCPU(tv, WORKER_CPU_SET); #ifndef AFLFUZZ_PCAP_RUNMODE @@ -250,9 +248,6 @@ int RunModeFilePcapAutoFp(void) TmThreadSetGroupName(tv_detect_ncpu, "Detect"); - /* Add logger. */ - SetupOutputs(tv_detect_ncpu); - TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET); if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) { diff --git a/src/tm-modules.c b/src/tm-modules.c index f0d8b89019..13fa409f19 100644 --- a/src/tm-modules.c +++ b/src/tm-modules.c @@ -233,7 +233,6 @@ const char * TmModuleTmmIdToString(TmmId id) CASE_CODE (TMM_DETECTLOADER); CASE_CODE (TMM_RECEIVENETMAP); CASE_CODE (TMM_DECODENETMAP); - CASE_CODE (TMM_LOGGER); CASE_CODE (TMM_SIZE); } diff --git a/src/tm-threads-common.h b/src/tm-threads-common.h index a0ca3bcad8..8325687a83 100644 --- a/src/tm-threads-common.h +++ b/src/tm-threads-common.h @@ -68,8 +68,6 @@ typedef enum { TMM_UNIXMANAGER, - TMM_LOGGER, - TMM_SIZE, } TmmId; diff --git a/src/tmqh-packetpool.c b/src/tmqh-packetpool.c index 07e0bc9d3c..913cb3e78c 100644 --- a/src/tmqh-packetpool.c +++ b/src/tmqh-packetpool.c @@ -448,15 +448,6 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p) SCEnter(); SCLogDebug("Packet %p, p->root %p, alloced %s", p, p->root, p->flags & PKT_ALLOC ? "true" : "false"); - /** \todo make this a callback - * Release tcp segments. Done here after alerting can use them. */ - if (p->flow != NULL && p->proto == IPPROTO_TCP) { - SCMutexLock(&p->flow->m); - StreamTcpPruneSession(p->flow, p->flowflags & FLOW_PKT_TOSERVER ? - STREAM_TOSERVER : STREAM_TOCLIENT); - SCMutexUnlock(&p->flow->m); - } - if (IS_TUNNEL_PKT(p)) { SCLogDebug("Packet %p is a tunnel packet: %s", p,p->root ? "upper layer" : "tunnel root"); diff --git a/src/util-runmodes.c b/src/util-runmodes.c index 26925c2eca..6800eb5e75 100644 --- a/src/util-runmodes.c +++ b/src/util-runmodes.c @@ -257,9 +257,6 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser, } TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL); - /* Add logger. */ - SetupOutputs(tv_detect_ncpu); - if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) { SCLogError(SC_ERR_RUNMODE, "TmThreadSpawn failed"); exit(EXIT_FAILURE); @@ -338,8 +335,6 @@ static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc Mod } TmSlotSetFuncAppend(tv, tm_module, NULL); - SetupOutputs(tv); - TmThreadSetCPU(tv, WORKER_CPU_SET); if (TmThreadSpawn(tv) != TM_ECODE_OK) { @@ -519,8 +514,6 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser, TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET); - SetupOutputs(tv_detect_ncpu); - TmThreadSetGroupName(tv_detect_ncpu, "Detect"); if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) { @@ -638,8 +631,6 @@ int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser, } TmSlotSetFuncAppend(tv, tm_module, NULL); - SetupOutputs(tv); - TmThreadSetCPU(tv, WORKER_CPU_SET); if (TmThreadSpawn(tv) != TM_ECODE_OK) {