|
|
|
|
@ -54,28 +54,57 @@ SCFPSupportSMList *sm_fp_support_smlist_list = NULL;
|
|
|
|
|
* keywords later.
|
|
|
|
|
*
|
|
|
|
|
* \param list_id SM list id.
|
|
|
|
|
* \param priority Priority for this list.
|
|
|
|
|
*/
|
|
|
|
|
static void SupportFastPatternForSigMatchList(int list_id)
|
|
|
|
|
{
|
|
|
|
|
if (sm_fp_support_smlist_list != NULL) {
|
|
|
|
|
SCFPSupportSMList *tmp_smlist_fp = sm_fp_support_smlist_list;
|
|
|
|
|
while (tmp_smlist_fp != NULL) {
|
|
|
|
|
if (tmp_smlist_fp->list_id == list_id)
|
|
|
|
|
return;
|
|
|
|
|
tmp_smlist_fp = tmp_smlist_fp->next;
|
|
|
|
|
static void SupportFastPatternForSigMatchList(int list_id, int priority)
|
|
|
|
|
{
|
|
|
|
|
if (sm_fp_support_smlist_list == NULL) {
|
|
|
|
|
SCFPSupportSMList *new = SCMalloc(sizeof(SCFPSupportSMList));
|
|
|
|
|
if (unlikely(new == NULL))
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
memset(new, 0, sizeof(SCFPSupportSMList));
|
|
|
|
|
new->list_id = list_id;
|
|
|
|
|
new->priority = priority;
|
|
|
|
|
|
|
|
|
|
sm_fp_support_smlist_list = new;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* insertion point - ip */
|
|
|
|
|
SCFPSupportSMList *ip = NULL;
|
|
|
|
|
for (SCFPSupportSMList *tmp = sm_fp_support_smlist_list; tmp != NULL; tmp = tmp->next) {
|
|
|
|
|
if (list_id == tmp->list_id) {
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "SM list already registered.");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (priority <= tmp->priority)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
ip = tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SCFPSupportSMList *new_smlist_fp = SCMalloc(sizeof(SCFPSupportSMList));
|
|
|
|
|
if (unlikely(new_smlist_fp == NULL)) {
|
|
|
|
|
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
|
|
|
|
|
SCFPSupportSMList *new = SCMalloc(sizeof(SCFPSupportSMList));
|
|
|
|
|
if (unlikely(new == NULL))
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
memset(new, 0, sizeof(SCFPSupportSMList));
|
|
|
|
|
new->list_id = list_id;
|
|
|
|
|
new->priority = priority;
|
|
|
|
|
if (ip == NULL) {
|
|
|
|
|
new->next = sm_fp_support_smlist_list;
|
|
|
|
|
sm_fp_support_smlist_list = new;
|
|
|
|
|
} else {
|
|
|
|
|
new->next = ip->next;
|
|
|
|
|
ip->next = new;
|
|
|
|
|
}
|
|
|
|
|
memset(new_smlist_fp, 0, sizeof(SCFPSupportSMList));
|
|
|
|
|
new_smlist_fp->list_id = list_id;
|
|
|
|
|
|
|
|
|
|
new_smlist_fp->next = sm_fp_support_smlist_list;
|
|
|
|
|
sm_fp_support_smlist_list = new_smlist_fp;
|
|
|
|
|
for (SCFPSupportSMList *tmp = new->next; tmp != NULL; tmp = tmp->next) {
|
|
|
|
|
if (list_id == tmp->list_id) {
|
|
|
|
|
SCLogError(SC_ERR_FATAL, "SM list already registered.");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -85,20 +114,34 @@ static void SupportFastPatternForSigMatchList(int list_id)
|
|
|
|
|
*/
|
|
|
|
|
void SupportFastPatternForSigMatchTypes(void)
|
|
|
|
|
{
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_PMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_UMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HCBDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSBDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HHDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRHDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HMDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HCDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRUDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSMDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSCDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HUADMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HHHDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRHHDMATCH);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HCBDMATCH, 2);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSBDMATCH, 2);
|
|
|
|
|
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HHDMATCH, 2);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRHDMATCH, 2);
|
|
|
|
|
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_UMATCH, 2);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRUDMATCH, 2);
|
|
|
|
|
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HHHDMATCH, 2);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HRHHDMATCH, 2);
|
|
|
|
|
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HCDMATCH, 2);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HUADMATCH, 2);
|
|
|
|
|
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_PMATCH, 3);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HMDMATCH, 3);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSCDMATCH, 3);
|
|
|
|
|
SupportFastPatternForSigMatchList(DETECT_SM_LIST_HSMDMATCH, 3);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
SCFPSupportSMList *tmp = sm_fp_support_smlist_list;
|
|
|
|
|
while (tmp != NULL) {
|
|
|
|
|
printf("%d - %d\n", tmp->list_id, tmp->priority);
|
|
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|