suricata
|
#include "suricata-common.h"
#include "suricata.h"
#include "conf.h"
#include "detect.h"
#include "detect-parse.h"
#include "runmodes.h"
#include "threads.h"
#include "threadvars.h"
#include "tm-threads.h"
#include "queue.h"
#include "detect-engine.h"
#include "detect-engine-loader.h"
#include "detect-engine-build.h"
#include "detect-engine-analyzer.h"
#include "detect-engine-mpm.h"
#include "detect-engine-sigorder.h"
#include "util-detect.h"
#include "util-threshold-config.h"
#include "util-path.h"
#include "rust.h"
Go to the source code of this file.
Data Structures | |
struct | DetectLoaderThreadData_ |
Macros | |
#define | NLOADERS 4 |
Typedefs | |
typedef struct DetectLoaderThreadData_ | DetectLoaderThreadData |
Functions | |
char * | DetectLoadCompleteSigPath (const DetectEngineCtx *de_ctx, const char *sig_file) |
Create the path if default-rule-path was specified. | |
int | SigLoadSignatures (DetectEngineCtx *de_ctx, char *sig_file, bool sig_file_exclusive) |
Load signatures. | |
int | DetectLoaderQueueTask (int loader_id, LoaderFunc Func, void *func_ctx, LoaderFreeFunc FreeFunc) |
int | DetectLoadersSync (void) |
wait for loader tasks to complete | |
void | DetectLoadersInit (void) |
void | TmThreadContinueDetectLoaderThreads (void) |
Unpauses all threads present in tv_root. | |
SC_ATOMIC_DECLARE (int, detect_loader_cnt) | |
void | DetectLoaderThreadSpawn (void) |
spawn the detect loader manager thread | |
void | TmModuleDetectLoaderRegister (void) |
Variables | |
int | rule_reload |
int | engine_analysis |
bool | rule_engine_analysis_set = false |
Definition in file detect-engine-loader.c.
#define NLOADERS 4 |
Definition at line 519 of file detect-engine-loader.c.
typedef struct DetectLoaderThreadData_ DetectLoaderThreadData |
char * DetectLoadCompleteSigPath | ( | const DetectEngineCtx * | de_ctx, |
const char * | sig_file | ||
) |
Create the path if default-rule-path was specified.
sig_file | The name of the file |
str | Pointer to the string path + sig_file |
Definition at line 106 of file detect-engine-loader.c.
References de_ctx.
Referenced by SigLoadSignatures().
int DetectLoaderQueueTask | ( | int | loader_id, |
LoaderFunc | Func, | ||
void * | func_ctx, | ||
LoaderFreeFunc | FreeFunc | ||
) |
loader | -1 for auto select |
loader_id | or negative in case of error |
Definition at line 527 of file detect-engine-loader.c.
References DetectLoaderTask_::ctx, DetectLoaderTask_::FreeFunc, DetectLoaderTask_::Func, DetectLoaderControl_::m, next, SCCalloc, SCLogDebug, SCMutexLock, SCMutexUnlock, and TAILQ_INSERT_TAIL.
void DetectLoadersInit | ( | void | ) |
Definition at line 604 of file detect-engine-loader.c.
References BUG_ON, FatalError, NLOADERS, SCCalloc, SCConfGetInt(), and SCLogInfo.
Referenced by DetectEngineMultiTenantSetup().
int DetectLoadersSync | ( | void | ) |
wait for loader tasks to complete
result | 0 for ok, -1 for errors |
Definition at line 561 of file detect-engine-loader.c.
References ThreadVars_::ctrl_cond, ThreadVars_::ctrl_mutex, DetectLoaderControl_::m, DetectLoaderControl_::result, SCCtrlMutexLock, SCCtrlMutexUnlock, SCLogDebug, SCLogError, SCMutexLock, SCMutexUnlock, TAILQ_EMPTY, and DetectLoaderControl_::tv.
Referenced by DetectEngineLoadTenantBlocking(), DetectEngineMultiTenantSetup(), DetectEngineReloadTenantBlocking(), and DetectEngineReloadTenantsBlocking().
void DetectLoaderThreadSpawn | ( | void | ) |
spawn the detect loader manager thread
Definition at line 749 of file detect-engine-loader.c.
References FatalError, name, thread_name_detect_loader, TM_ECODE_OK, TM_THREAD_NAME_MAX, TmThreadCreateCmdThreadByName(), and TmThreadSpawn().
Referenced by DetectEngineMultiTenantSetup().
SC_ATOMIC_DECLARE | ( | int | , |
detect_loader_cnt | |||
) |
int SigLoadSignatures | ( | DetectEngineCtx * | de_ctx, |
char * | sig_file, | ||
bool | sig_file_exclusive | ||
) |
Load signatures.
de_ctx | Pointer to the detection engine context |
sig_file | Filename (or pattern) holding signatures |
sig_file_exclusive | File passed in 'sig_file' should be loaded exclusively. |
-1 | on error |
Definition at line 372 of file detect-engine-loader.c.
References SigFileLoaderStat_::bad_files, SigFileLoaderStat_::bad_sigs_total, MpmTableElmt_::CacheRuleset, CleanupEngineAnalysis(), DetectEngineCtx_::config_prefix, de_ctx, DetectLoadCompleteSigPath(), DetectParseDupSigHashFree(), DetectEngineCtx_::failure_fatal, DetectEngineCtx_::firewall_rule_file_exclusive, SigFileLoaderStat_::good_sigs_total, DetectEngineCtx_::last_reload, DetectEngineCtx_::mpm_cfg, DetectEngineCtx_::mpm_matcher, mpm_table, next, PROG_VER, DetectEngineCtx_::requirements, rule_engine_analysis_set, RUNMODE_ENGINE_ANALYSIS, SCConfGetNode(), SCConfNodeIsSequence(), SCEnter, SCFree, SCLogConfig, SCLogInfo, SCLogWarning, SCReturnInt, SCRunmodeGet(), SCSigOrderSignatures(), SCSigRegisterSignatureOrderingFuncs(), SCSigSignatureOrderingModuleCleanup(), SCThresholdConfInitContext(), SetupEngineAnalysis(), DetectEngineCtx_::sig_stat, SigGroupBuild(), SigFileLoaderStat_::skipped_sigs_total, TAILQ_FOREACH, DetectEngineCtx_::tenant_id, SigFileLoaderStat_::total_files, and SCConfNode_::val.
Referenced by DetectEngineReload().
void TmModuleDetectLoaderRegister | ( | void | ) |
Definition at line 765 of file detect-engine-loader.c.
References TmModule_::cap_flags, TmModule_::flags, TmModule_::Management, TmModule_::name, name, SC_ATOMIC_INIT, SCLogDebug, TmModule_::ThreadDeinit, TmModule_::ThreadInit, TM_FLAG_MANAGEMENT_TM, TMM_DETECTLOADER, and tmm_modules.
Referenced by DetectEngineMultiTenantSetup().
void TmThreadContinueDetectLoaderThreads | ( | void | ) |
Unpauses all threads present in tv_root.
Definition at line 649 of file detect-engine-loader.c.
References ThreadVars_::name, ThreadVars_::next, SCMutexLock, SCMutexUnlock, TmThreadContinue(), tv, tv_root, tv_root_lock, and TVT_MAX.
Referenced by DetectEngineMultiTenantSetup().
|
extern |
Referenced by SCParseCommandLine().
bool rule_engine_analysis_set = false |
Definition at line 56 of file detect-engine-loader.c.
Referenced by DetectFlowbitsAnalyze(), and SigLoadSignatures().
|
extern |