From: Victor Julien Date: Mon, 23 Oct 2017 10:29:55 +0000 (+0200) Subject: detect/fast-pattern: use registered buffers for check X-Git-Tag: suricata-4.1.0-beta1~312 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91827568918a6ad84b808d4c3f63100bfab50b4d;p=thirdparty%2Fsuricata.git detect/fast-pattern: use registered buffers for check --- diff --git a/src/detect-fast-pattern.c b/src/detect-fast-pattern.c index 0211cbf176..1bea3e245b 100644 --- a/src/detect-fast-pattern.c +++ b/src/detect-fast-pattern.c @@ -49,6 +49,37 @@ void DetectFastPatternRegisterTests(void); * that has fp support */ SCFPSupportSMList *sm_fp_support_smlist_list = NULL; +/** + * \brief Checks if a particular list(Signature->sm_lists[]) is in the list + * of lists that need to be searched for a keyword that has fp support. + * + * \param list_id The list id. + * + * \retval 1 If supported. + * \retval 0 If not. + */ +int FastPatternSupportEnabledForSigMatchList(int list_id) +{ + if (sm_fp_support_smlist_list == NULL) + return 0; + + if (list_id == DETECT_SM_LIST_PMATCH) + return 1; + + return DetectBufferTypeSupportsMpmGetById(list_id); + +#if 0 + SCFPSupportSMList *tmp_smlist_fp = sm_fp_support_smlist_list; + while (tmp_smlist_fp != NULL) { + if (tmp_smlist_fp->list_id == list_id) + return 1; + + tmp_smlist_fp = tmp_smlist_fp->next; + } +#endif + return 0; +} + /** * \brief Lets one add a sm list id to be searched for potential fp supported * keywords later. diff --git a/src/detect-fast-pattern.h b/src/detect-fast-pattern.h index ff8bc5cc37..30172b8cbf 100644 --- a/src/detect-fast-pattern.h +++ b/src/detect-fast-pattern.h @@ -34,32 +34,8 @@ typedef struct SCFPSupportSMList_ { extern SCFPSupportSMList *sm_fp_support_smlist_list; -/** - * \brief Checks if a particular list(Signature->sm_lists[]) is in the list - * of lists that need to be searched for a keyword that has fp support. - * - * \param list_id The list id. - * - * \retval 1 If supported. - * \retval 0 If not. - */ -static inline int FastPatternSupportEnabledForSigMatchList(int list_id) -{ - if (sm_fp_support_smlist_list == NULL) - return 0; - - SCFPSupportSMList *tmp_smlist_fp = sm_fp_support_smlist_list; - while (tmp_smlist_fp != NULL) { - if (tmp_smlist_fp->list_id == list_id) - return 1; - - tmp_smlist_fp = tmp_smlist_fp->next; - } - - return 0; -} - void SupportFastPatternForSigMatchList(int list_id, int priority); +int FastPatternSupportEnabledForSigMatchList(int list_id); void SupportFastPatternForSigMatchTypes(void);