|
|
@ -2661,6 +2661,10 @@ void DetectEngineCtxFree(DetectEngineCtx *de_ctx)
|
|
|
|
SCClassConfDeinit(de_ctx);
|
|
|
|
SCClassConfDeinit(de_ctx);
|
|
|
|
SCReferenceConfDeinit(de_ctx);
|
|
|
|
SCReferenceConfDeinit(de_ctx);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (de_ctx->tenant_path) {
|
|
|
|
|
|
|
|
SCFree(de_ctx->tenant_path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SCFree(de_ctx);
|
|
|
|
SCFree(de_ctx);
|
|
|
|
//DetectAddressGroupPrintMemory();
|
|
|
|
//DetectAddressGroupPrintMemory();
|
|
|
|
//DetectSigGroupPrintMemory();
|
|
|
|
//DetectSigGroupPrintMemory();
|
|
|
@ -3844,6 +3848,11 @@ static int DetectEngineMultiTenantLoadTenant(uint32_t tenant_id, const char *fil
|
|
|
|
de_ctx->type = DETECT_ENGINE_TYPE_TENANT;
|
|
|
|
de_ctx->type = DETECT_ENGINE_TYPE_TENANT;
|
|
|
|
de_ctx->tenant_id = tenant_id;
|
|
|
|
de_ctx->tenant_id = tenant_id;
|
|
|
|
de_ctx->loader_id = loader_id;
|
|
|
|
de_ctx->loader_id = loader_id;
|
|
|
|
|
|
|
|
de_ctx->tenant_path = SCStrdup(filename);
|
|
|
|
|
|
|
|
if (de_ctx->tenant_path == NULL) {
|
|
|
|
|
|
|
|
SCLogError("Failed to duplicate path");
|
|
|
|
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (SigLoadSignatures(de_ctx, NULL, 0) < 0) {
|
|
|
|
if (SigLoadSignatures(de_ctx, NULL, 0) < 0) {
|
|
|
|
SCLogError("Loading signatures failed.");
|
|
|
|
SCLogError("Loading signatures failed.");
|
|
|
@ -3869,6 +3878,9 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (filename == NULL)
|
|
|
|
|
|
|
|
filename = old_de_ctx->tenant_path;
|
|
|
|
|
|
|
|
|
|
|
|
char prefix[64];
|
|
|
|
char prefix[64];
|
|
|
|
snprintf(prefix, sizeof(prefix), "multi-detect.%u.reload.%d", tenant_id, reload_cnt);
|
|
|
|
snprintf(prefix, sizeof(prefix), "multi-detect.%u.reload.%d", tenant_id, reload_cnt);
|
|
|
|
reload_cnt++;
|
|
|
|
reload_cnt++;
|
|
|
@ -3896,6 +3908,11 @@ static int DetectEngineMultiTenantReloadTenant(uint32_t tenant_id, const char *f
|
|
|
|
new_de_ctx->type = DETECT_ENGINE_TYPE_TENANT;
|
|
|
|
new_de_ctx->type = DETECT_ENGINE_TYPE_TENANT;
|
|
|
|
new_de_ctx->tenant_id = tenant_id;
|
|
|
|
new_de_ctx->tenant_id = tenant_id;
|
|
|
|
new_de_ctx->loader_id = old_de_ctx->loader_id;
|
|
|
|
new_de_ctx->loader_id = old_de_ctx->loader_id;
|
|
|
|
|
|
|
|
new_de_ctx->tenant_path = SCStrdup(filename);
|
|
|
|
|
|
|
|
if (new_de_ctx->tenant_path == NULL) {
|
|
|
|
|
|
|
|
SCLogError("Failed to duplicate path");
|
|
|
|
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (SigLoadSignatures(new_de_ctx, NULL, 0) < 0) {
|
|
|
|
if (SigLoadSignatures(new_de_ctx, NULL, 0) < 0) {
|
|
|
|
SCLogError("Loading signatures failed.");
|
|
|
|
SCLogError("Loading signatures failed.");
|
|
|
@ -3982,11 +3999,13 @@ static int DetectLoaderSetupReloadTenant(uint32_t tenant_id, const char *yaml, i
|
|
|
|
return -ENOMEM;
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
|
|
t->tenant_id = tenant_id;
|
|
|
|
t->tenant_id = tenant_id;
|
|
|
|
|
|
|
|
if (yaml != NULL) {
|
|
|
|
t->yaml = SCStrdup(yaml);
|
|
|
|
t->yaml = SCStrdup(yaml);
|
|
|
|
if (t->yaml == NULL) {
|
|
|
|
if (t->yaml == NULL) {
|
|
|
|
SCFree(t);
|
|
|
|
SCFree(t);
|
|
|
|
return -ENOMEM;
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
t->reload_cnt = reload_cnt;
|
|
|
|
t->reload_cnt = reload_cnt;
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("loader_id %d", loader_id);
|
|
|
|
SCLogDebug("loader_id %d", loader_id);
|
|
|
|