]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
byte_extract_id var now a non-global de_ctx specific var
authorAnoop Saldanha <poonaatsoc@gmail.com>
Fri, 22 Jun 2012 12:33:12 +0000 (18:03 +0530)
committerVictor Julien <victor@inliniac.net>
Tue, 26 Jun 2012 07:36:10 +0000 (09:36 +0200)
src/detect-byte-extract.c
src/detect-byte-extract.h
src/detect-engine.c
src/detect.h

index 2098b67ce527658202103c5c60d463eca6c40684..8bbbb295cf136a4fb4841cc97c92111e4f4cac29 100644 (file)
@@ -89,8 +89,6 @@
 static pcre *parse_regex;
 static pcre_extra *parse_regex_study;
 
-int byte_extract_max_local_id = 0;
-
 int DetectByteExtractMatch(ThreadVars *, DetectEngineThreadCtx *,
                            Packet *, Signature *, SigMatch *);
 int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *);
@@ -568,8 +566,8 @@ int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
     } else {
         bed->local_id = ((DetectByteExtractData *)prev_bed_sm->ctx)->local_id + 1;
     }
-    if (bed->local_id > byte_extract_max_local_id)
-        byte_extract_max_local_id = bed->local_id;
+    if (bed->local_id > de_ctx->byte_extract_max_local_id)
+        de_ctx->byte_extract_max_local_id = bed->local_id;
 
     /* check bytetest modifiers against the signature alproto.  In case they conflict
      * chuck out invalid signature */
index 3dbc39a66958cd6ebdc6b3cc55f70e98dd0965ee..eb889d7384b93462072220069be4e810648e9c95 100644 (file)
@@ -59,9 +59,6 @@ typedef struct DetectByteExtractData_ {
 
 } DetectByteExtractData;
 
-/* the max local id used amongst all sigs */
-extern int byte_extract_max_local_id;
-
 void DetectByteExtractRegister(void);
 int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *);
 void DetectByteExtractFree(void *);
index a35eb14482658d7dd655146ece870db7f9c77131..46cea5db2872a17494a772a81e14c157bd0e69ba 100644 (file)
@@ -453,7 +453,7 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data) {
     /* this detection engine context belongs to this thread instance */
     det_ctx->tv = tv;
 
-    det_ctx->bj_values = SCMalloc(sizeof(*det_ctx->bj_values) * (byte_extract_max_local_id + 1));
+    det_ctx->bj_values = SCMalloc(sizeof(*det_ctx->bj_values) * de_ctx->byte_extract_max_local_id);
     if (det_ctx->bj_values == NULL) {
         return TM_ECODE_FAILED;
     }
index 652f07156fb73a15aeef61fa963cc57feb74e61e..eb425947c3db137f1aed9378f720cd96ec4544c5 100644 (file)
@@ -656,6 +656,9 @@ typedef struct DetectEngineCtx_ {
     int32_t sgh_mpm_context_huad;
     int32_t sgh_mpm_context_app_proto_detect;
 
+    /* the max local id used amongst all sigs */
+    int32_t byte_extract_max_local_id;
+
     /** sgh for signatures that match against invalid packets. In those cases
      *  we can't lookup by proto, address, port as we don't have these */
     struct SigGroupHead_ *decoder_event_sgh;