ConfNode *rule_files;
ConfNode *file = NULL;
- SigFileLoaderStat sig_stat;
+ SigFileLoaderStat *sig_stat = &de_ctx->sig_stat;
int ret = 0;
char *sfile = NULL;
char varname[128] = "rule-files";
int good_sigs = 0;
int bad_sigs = 0;
- memset(&sig_stat, 0, sizeof(SigFileLoaderStat));
-
if (strlen(de_ctx->config_prefix) > 0) {
snprintf(varname, sizeof(varname), "%s.rule-files",
de_ctx->config_prefix);
TAILQ_FOREACH(file, &rule_files->head, next) {
sfile = DetectLoadCompleteSigPath(de_ctx, file->val);
good_sigs = bad_sigs = 0;
- ret = ProcessSigFiles(de_ctx, sfile, &sig_stat, &good_sigs, &bad_sigs);
+ ret = ProcessSigFiles(de_ctx, sfile, sig_stat, &good_sigs, &bad_sigs);
SCFree(sfile);
if (de_ctx->failure_fatal && ret != 0) {
/* If a Signature file is specified from commandline, parse it too */
if (sig_file != NULL) {
- ret = ProcessSigFiles(de_ctx, sig_file, &sig_stat, &good_sigs, &bad_sigs);
+ ret = ProcessSigFiles(de_ctx, sig_file, sig_stat, &good_sigs, &bad_sigs);
if (ret != 0) {
if (de_ctx->failure_fatal == 1) {
}
/* now we should have signatures to work with */
- if (sig_stat.good_sigs_total <= 0) {
- if (sig_stat.total_files > 0) {
- SCLogWarning(SC_ERR_NO_RULES_LOADED, "%d rule files specified, but no rule was loaded at all!", sig_stat.total_files);
+ if (sig_stat->good_sigs_total <= 0) {
+ if (sig_stat->total_files > 0) {
+ SCLogWarning(SC_ERR_NO_RULES_LOADED, "%d rule files specified, but no rule was loaded at all!", sig_stat->total_files);
} else {
SCLogInfo("No signatures supplied.");
goto end;
} else {
/* we report the total of files and rules successfully loaded and failed */
SCLogInfo("%" PRId32 " rule files processed. %" PRId32 " rules successfully loaded, %" PRId32 " rules failed",
- sig_stat.total_files, sig_stat.good_sigs_total, sig_stat.bad_sigs_total);
+ sig_stat->total_files, sig_stat->good_sigs_total, sig_stat->bad_sigs_total);
}
- if ((sig_stat.bad_sigs_total || sig_stat.bad_files) && de_ctx->failure_fatal) {
+ if ((sig_stat->bad_sigs_total || sig_stat->bad_files) && de_ctx->failure_fatal) {
ret = -1;
goto end;
}
ret = 0;
end:
+ gettimeofday(&de_ctx->last_reload, NULL);
if (RunmodeGetCurrent() == RUNMODE_ENGINE_ANALYSIS) {
if (rule_engine_analysis_set) {
CleanupRuleAnalyzer();
uint32_t th_size;
} ThresholdCtx;
+/** \brief Signature loader statistics */
+typedef struct SigFileLoaderStat_ {
+ int bad_files;
+ int total_files;
+ int good_sigs_total;
+ int bad_sigs_total;
+} SigFileLoaderStat;
+
typedef struct DetectEngineThreadKeywordCtxItem_ {
void *(*InitFunc)(void *);
void (*FreeFunc)(void *);
* \todo we only need this at init, so perhaps this
* can move to a DetectEngineCtx 'init' struct */
DetectMpmAppLayerKeyword *app_mpms;
+
+ /** time of last ruleset reload */
+ struct timeval last_reload;
+
+ /** signatures stats */
+ SigFileLoaderStat sig_stat;
+
} DetectEngineCtx;
/* Engine groups profiles (low, medium, high, custom) */
int keyword_id;
} DetectEngineMasterCtx;
-/** \brief Signature loader statistics */
-typedef struct SigFileLoaderStat_ {
- int bad_files;
- int total_files;
- int good_sigs_total;
- int bad_sigs_total;
-} SigFileLoaderStat;
-
/** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */
enum {