detect: break apart sigtable setup and initialization

Allows initialization to be done early, so the table is ready for
dynamic registration by plugins which are loaded before signature
setup.
pull/12117/head
Jason Ish 2 years ago committed by Victor Julien
parent 83b1e40028
commit 2ac16ee1a6

@ -439,7 +439,7 @@ void SigTableCleanup(void)
}
}
void SigTableSetup(void)
void SigTableInit(void)
{
if (sigmatch_table == NULL) {
DETECT_TBLSIZE = DETECT_TBLSIZE_STATIC + DETECT_TBLSIZE_STEP;
@ -447,10 +447,12 @@ void SigTableSetup(void)
if (sigmatch_table == NULL) {
DETECT_TBLSIZE = 0;
FatalError("Could not allocate sigmatch_table");
return;
}
}
}
void SigTableSetup(void)
{
DetectSidRegister();
DetectPriorityRegister();
DetectPrefilterRegister();

@ -338,6 +338,7 @@ extern int DETECT_TBLSIZE_IDX;
#define DETECT_TBLSIZE_STEP 256
int SigTableList(const char *keyword);
void SigTableCleanup(void);
void SigTableInit(void);
void SigTableSetup(void);
void SigTableRegisterTests(void);

@ -240,6 +240,7 @@ void RunUnittests(int list_unittests, const char *regex_arg)
AppLayerSetup();
/* hardcoded initialization code */
SigTableInit();
SigTableSetup(); /* load the rule keywords */
TmqhSetup();

@ -2670,6 +2670,8 @@ int PostConfLoadedSetup(SCInstance *suri)
MacSetRegisterFlowStorage();
SigTableInit();
#ifdef HAVE_PLUGINS
SCPluginsLoad(suri->capture_plugin_name, suri->capture_plugin_args);
#endif

@ -27,6 +27,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
MpmTableSetup();
SpmTableSetup();
EngineModeSetIDS();
SigTableInit();
SigTableSetup();
}
if (cnt++ == 1024) {

Loading…
Cancel
Save