}
if (!(de_ctx->flags & DE_QUIET)) {
- SCLogInfo("%" PRIu32 " signatures processed. %" PRIu32 " are IP-only "
- "rules, %" PRIu32 " are inspecting packet payload, %"PRIu32
- " inspect application layer, %"PRIu32" are decoder event only",
- de_ctx->sig_cnt, cnt_iponly, cnt_payload, cnt_applayer,
- cnt_deonly);
+ if (strlen(de_ctx->config_prefix) > 0)
+ SCLogInfo("tenant id %d: %" PRIu32 " signatures processed. %" PRIu32 " are IP-only "
+ "rules, %" PRIu32 " are inspecting packet payload, %" PRIu32
+ " inspect application layer, %" PRIu32 " are decoder event only",
+ de_ctx->tenant_id, de_ctx->sig_cnt, cnt_iponly, cnt_payload, cnt_applayer,
+ cnt_deonly);
+ else
+ SCLogInfo("%" PRIu32 " signatures processed. %" PRIu32 " are IP-only "
+ "rules, %" PRIu32 " are inspecting packet payload, %" PRIu32
+ " inspect application layer, %" PRIu32 " are decoder event only",
+ de_ctx->sig_cnt, cnt_iponly, cnt_payload, cnt_applayer, cnt_deonly);
SCLogConfig("building signature grouping structure, stage 1: "
"preprocessing rules... complete");
if (strcmp("/dev/null", fname) == 0)
return 0;
#endif
- SCLogConfig("Loading rule file: %s", fname);
+ if (strlen(de_ctx->config_prefix) > 0) {
+ SCLogConfig("tenant id %d: Loading rule file: %s", de_ctx->tenant_id, fname);
+ } else {
+ SCLogConfig("Loading rule file: %s", fname);
+ }
r = DetectLoadSigFile(de_ctx, fname, good_sigs, bad_sigs);
if (r < 0) {
++(st->bad_files);
}
} 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);
+ if (strlen(de_ctx->config_prefix) > 0)
+ SCLogInfo("tenant id %d: %" PRId32 " rule files processed. %" PRId32
+ " rules successfully loaded, %" PRId32 " rules failed",
+ de_ctx->tenant_id, sig_stat->total_files, sig_stat->good_sigs_total,
+ sig_stat->bad_sigs_total);
+ else
+ 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);
}
if ((sig_stat->bad_sigs_total || sig_stat->bad_files) && de_ctx->failure_fatal) {
return -1;
}
-static DetectEngineCtx *DetectEngineCtxInitReal(enum DetectEngineType type, const char *prefix)
+static DetectEngineCtx *DetectEngineCtxInitReal(
+ enum DetectEngineType type, const char *prefix, uint32_t tenant_id)
{
DetectEngineCtx *de_ctx = SCMalloc(sizeof(DetectEngineCtx));
if (unlikely(de_ctx == NULL))
de_ctx->sigerror = NULL;
de_ctx->type = type;
de_ctx->filemagic_thread_ctx_id = -1;
+ de_ctx->tenant_id = tenant_id;
if (type == DETECT_ENGINE_TYPE_DD_STUB || type == DETECT_ENGINE_TYPE_MT_STUB) {
de_ctx->version = DetectEngineGetVersion();
DetectEngineCtx *DetectEngineCtxInitStubForMT(void)
{
- return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_MT_STUB, NULL);
+ return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_MT_STUB, NULL, 0);
}
DetectEngineCtx *DetectEngineCtxInitStubForDD(void)
{
- return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_DD_STUB, NULL);
+ return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_DD_STUB, NULL, 0);
}
DetectEngineCtx *DetectEngineCtxInit(void)
{
- return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_NORMAL, NULL);
+ return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_NORMAL, NULL, 0);
}
-DetectEngineCtx *DetectEngineCtxInitWithPrefix(const char *prefix)
+DetectEngineCtx *DetectEngineCtxInitWithPrefix(const char *prefix, uint32_t tenant_id)
{
if (prefix == NULL || strlen(prefix) == 0)
return DetectEngineCtxInit();
else
- return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_NORMAL, prefix);
+ return DetectEngineCtxInitReal(DETECT_ENGINE_TYPE_NORMAL, prefix, tenant_id);
}
static void DetectEngineCtxFreeThreadKeywordData(DetectEngineCtx *de_ctx)
goto error;
}
- de_ctx = DetectEngineCtxInitWithPrefix(prefix);
+ de_ctx = DetectEngineCtxInitWithPrefix(prefix, tenant_id);
if (de_ctx == NULL) {
SCLogError("initializing detection engine "
"context failed.");
goto error;
}
- DetectEngineCtx *new_de_ctx = DetectEngineCtxInitWithPrefix(prefix);
+ DetectEngineCtx *new_de_ctx = DetectEngineCtxInitWithPrefix(prefix, tenant_id);
if (new_de_ctx == NULL) {
SCLogError("initializing detection engine "
"context failed.");
}
/* get new detection engine */
- new_de_ctx = DetectEngineCtxInitWithPrefix(prefix);
+ new_de_ctx = DetectEngineCtxInitWithPrefix(prefix, old_de_ctx->tenant_id);
if (new_de_ctx == NULL) {
SCLogError("initializing detection engine "
"context failed.");
void DetectEngineBufferTypeSupportsTransformations(DetectEngineCtx *de_ctx, const char *name);
/* prototypes */
-DetectEngineCtx *DetectEngineCtxInitWithPrefix(const char *prefix);
+DetectEngineCtx *DetectEngineCtxInitWithPrefix(const char *prefix, uint32_t tenant_id);
DetectEngineCtx *DetectEngineCtxInit(void);
DetectEngineCtx *DetectEngineCtxInitStubForDD(void);
DetectEngineCtx *DetectEngineCtxInitStubForMT(void);
}
#ifdef UNITTESTS
- SCLogInfo("Added \"%d\" classification types from the classification file",
- de_ctx->class_conf_ht->count);
+ if (de_ctx != NULL && strlen(de_ctx->config_prefix) > 0)
+ SCLogInfo("tenant id %d: Added \"%d\" classification types from the classification file",
+ de_ctx->tenant_id, de_ctx->class_conf_ht->count);
+ else
+ SCLogInfo("Added \"%d\" classification types from the classification file",
+ de_ctx->class_conf_ht->count);
#endif
return errors == 0;
}
#ifdef UNITTESTS
- SCLogInfo("Added \"%d\" reference types from the reference.config file",
- de_ctx->reference_conf_ht->count);
+ if (de_ctx != NULL && strlen(de_ctx->config_prefix) > 0)
+ SCLogInfo("tenant id %d: Added \"%d\" reference types from the reference.config file",
+ de_ctx->tenant_id, de_ctx->reference_conf_ht->count);
+ else
+ SCLogInfo("Added \"%d\" reference types from the reference.config file",
+ de_ctx->reference_conf_ht->count);
#endif /* UNITTESTS */
return true;
}
}
}
- SCLogInfo("Threshold config parsed: %d rule(s) found", rule_num);
+ if (de_ctx != NULL && strlen(de_ctx->config_prefix) > 0)
+ SCLogInfo("tenant id %d: Threshold config parsed: %d rule(s) found", de_ctx->tenant_id,
+ rule_num);
+ else
+ SCLogInfo("Threshold config parsed: %d rule(s) found", rule_num);
return 0;
}