byte_extract_id var now a non-global de_ctx specific var

remotes/origin/HEAD
Anoop Saldanha 13 years ago committed by Victor Julien
parent f4ce9011d2
commit 5878d83174

@ -89,8 +89,6 @@
static pcre *parse_regex; static pcre *parse_regex;
static pcre_extra *parse_regex_study; static pcre_extra *parse_regex_study;
int byte_extract_max_local_id = 0;
int DetectByteExtractMatch(ThreadVars *, DetectEngineThreadCtx *, int DetectByteExtractMatch(ThreadVars *, DetectEngineThreadCtx *,
Packet *, Signature *, SigMatch *); Packet *, Signature *, SigMatch *);
int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *); int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *);
@ -568,8 +566,8 @@ int DetectByteExtractSetup(DetectEngineCtx *de_ctx, Signature *s, char *arg)
} else { } else {
bed->local_id = ((DetectByteExtractData *)prev_bed_sm->ctx)->local_id + 1; bed->local_id = ((DetectByteExtractData *)prev_bed_sm->ctx)->local_id + 1;
} }
if (bed->local_id > byte_extract_max_local_id) if (bed->local_id > de_ctx->byte_extract_max_local_id)
byte_extract_max_local_id = bed->local_id; de_ctx->byte_extract_max_local_id = bed->local_id;
/* check bytetest modifiers against the signature alproto. In case they conflict /* check bytetest modifiers against the signature alproto. In case they conflict
* chuck out invalid signature */ * chuck out invalid signature */

@ -59,9 +59,6 @@ typedef struct DetectByteExtractData_ {
} DetectByteExtractData; } DetectByteExtractData;
/* the max local id used amongst all sigs */
extern int byte_extract_max_local_id;
void DetectByteExtractRegister(void); void DetectByteExtractRegister(void);
int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *); int DetectByteExtractSetup(DetectEngineCtx *, Signature *, char *);
void DetectByteExtractFree(void *); void DetectByteExtractFree(void *);

@ -453,7 +453,7 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data) {
/* this detection engine context belongs to this thread instance */ /* this detection engine context belongs to this thread instance */
det_ctx->tv = tv; 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) { if (det_ctx->bj_values == NULL) {
return TM_ECODE_FAILED; return TM_ECODE_FAILED;
} }

@ -656,6 +656,9 @@ typedef struct DetectEngineCtx_ {
int32_t sgh_mpm_context_huad; int32_t sgh_mpm_context_huad;
int32_t sgh_mpm_context_app_proto_detect; 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 /** 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 */ * we can't lookup by proto, address, port as we don't have these */
struct SigGroupHead_ *decoder_event_sgh; struct SigGroupHead_ *decoder_event_sgh;

Loading…
Cancel
Save