]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/fast-pattern: use registered buffers for check
authorVictor Julien <victor@inliniac.net>
Mon, 23 Oct 2017 10:29:55 +0000 (12:29 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Jan 2018 09:15:52 +0000 (10:15 +0100)
src/detect-fast-pattern.c
src/detect-fast-pattern.h

index 0211cbf1767c6c4d89666a3aea6ce8c5658dca65..1bea3e245b0190f3d5ac96c1109403c209d5121a 100644 (file)
@@ -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.
index ff8bc5cc3708444490146d7246074e7866923040..30172b8cbf3aedcd38e6db95651bb5231429baad 100644 (file)
@@ -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);