]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: use detect list passed to generic funcs
authorVictor Julien <victor@inliniac.net>
Sat, 15 Oct 2016 22:07:48 +0000 (00:07 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Feb 2017 09:35:37 +0000 (10:35 +0100)
Until now the GenericList users used hardcoded list id's.

src/detect-dnp3.c
src/detect-engine-dns.c
src/detect-engine-tls.c
src/detect-engine.c
src/detect-engine.h

index b2b945d0bcd2fbad66c239c119179302dbbb5104..7cc965905dbd76ff68044db79690836d66da7693 100644 (file)
@@ -166,8 +166,8 @@ static int DetectEngineInspectDNP3(ThreadVars *tv, DetectEngineCtx *de_ctx,
     DetectEngineThreadCtx *det_ctx, const Signature *s, const SigMatchData *smd,
     Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
 {
-    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, f, flags,
-        alstate, txv, tx_id, DETECT_SM_LIST_DNP3_MATCH);
+    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd,
+        f, flags, alstate, txv, tx_id);
 }
 
 /**
index d243ba025504287238279aae68de1277054cc413..314b095685c17f6247a2e8d1f0ce77a56b1183ea 100644 (file)
@@ -140,20 +140,18 @@ int PrefilterTxDnsQueryRegister(SigGroupHead *sgh, MpmCtx *mpm_ctx)
 
 int DetectEngineInspectDnsRequest(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const Signature *s, const SigMatch *sm,
+        const Signature *s, const SigMatchData *smd,
         Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
 {
-    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, f, flags,
-                                          alstate, txv, tx_id,
-                                          DETECT_SM_LIST_DNSREQUEST_MATCH);
+    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd,
+                                          f, flags, alstate, txv, tx_id);
 }
 
 int DetectEngineInspectDnsResponse(ThreadVars *tv,
         DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx,
-        const Signature *s, const SigMatch *sm,
+        const Signature *s, const SigMatchData *smd,
         Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
 {
-    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, f, flags,
-                                          alstate, txv, tx_id,
-                                          DETECT_SM_LIST_DNSRESPONSE_MATCH);
+    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd,
+                                          f, flags, alstate, txv, tx_id);
 }
index 43db1f42ad3774b336d030d51be683aff1b7b330..9b0d35b784514c2483d7acc533227220ce4c25e2 100644 (file)
@@ -277,7 +277,6 @@ int DetectEngineInspectTlsValidity(ThreadVars *tv,
         Flow *f, uint8_t flags, void *alstate,
         void *txv, uint64_t tx_id)
 {
-    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, f, flags,
-                                          alstate, txv, tx_id,
-                                          DETECT_SM_LIST_TLSVALIDITY_MATCH);
+    return DetectEngineInspectGenericList(tv, de_ctx, det_ctx, s, smd,
+                                          f, flags, alstate, txv, tx_id);
 }
index a5ccbf79f95c26e0f5b66794a8acf6155a263b60..45061fda2ba53347109c1babcc3558000463043a 100644 (file)
@@ -192,13 +192,13 @@ int DetectEngineAppInspectionEngine2Signature(Signature *s)
             case DETECT_SM_LIST_FILEMATCH:
 
             case DETECT_SM_LIST_DNSQUERYNAME_MATCH:
-            //case DETECT_SM_LIST_DNSRESPONSE_MATCH:
-            //case DETECT_SM_LIST_DNSRESPONSE_MATCH:
+            case DETECT_SM_LIST_DNSREQUEST_MATCH:
+            case DETECT_SM_LIST_DNSRESPONSE_MATCH:
 
             case DETECT_SM_LIST_TLSSNI_MATCH:
             case DETECT_SM_LIST_TLSISSUER_MATCH:
             case DETECT_SM_LIST_TLSSUBJECT_MATCH:
-            //case DETECT_SM_LIST_TLSVALIDITY_MATCH:
+            case DETECT_SM_LIST_TLSVALIDITY_MATCH:
 
             case DETECT_SM_LIST_APP_EVENT:
 
@@ -352,13 +352,10 @@ int DetectEngineReloadIsDone(void)
 int DetectEngineInspectGenericList(ThreadVars *tv,
                                    const DetectEngineCtx *de_ctx,
                                    DetectEngineThreadCtx *det_ctx,
-                                   const Signature *s, Flow *f, const uint8_t flags,
-                                   void *alstate, void *txv, uint64_t tx_id, const int list)
+                                   const Signature *s, const SigMatchData *smd,
+                                   Flow *f, const uint8_t flags,
+                                   void *alstate, void *txv, uint64_t tx_id)
 {
-#ifdef PROFILING
-    KEYWORD_PROFILING_SET_LIST(det_ctx, list);
-#endif
-    SigMatchData *smd = s->sm_arrays[list];
     SCLogDebug("running match functions, sm %p", smd);
     if (smd != NULL) {
         while (1) {
index 378706187fbdf085d41103ef7555522c7535273f..e3acb692e99f2ea4db4008a42e460894b61c5b4a 100644 (file)
@@ -70,9 +70,10 @@ int DetectEngineTentantRegisterPcapFile(uint32_t tenant_id);
 int DetectEngineTentantUnregisterPcapFile(uint32_t tenant_id);
 
 int DetectEngineInspectGenericList(ThreadVars *, const DetectEngineCtx *,
-                                   DetectEngineThreadCtx *, const Signature *,
+                                   DetectEngineThreadCtx *,
+                                   const Signature *, const SigMatchData *,
                                    Flow *, const uint8_t, void *, void *,
-                                   uint64_t, const int);
+                                   uint64_t);
 
 /**
  * \brief Registers an app inspection engine.