|
|
|
@ -397,6 +397,8 @@ void EngineAnalysisFastPattern(Signature *s)
|
|
|
|
} /* for ( ; list_id < DETECT_SM_LIST_MAX; list_id++) */
|
|
|
|
} /* for ( ; list_id < DETECT_SM_LIST_MAX; list_id++) */
|
|
|
|
|
|
|
|
|
|
|
|
int max_len = 0;
|
|
|
|
int max_len = 0;
|
|
|
|
|
|
|
|
int max_len_negated = 0;
|
|
|
|
|
|
|
|
int max_len_non_negated = 0;
|
|
|
|
/* get the longest pattern in the sig */
|
|
|
|
/* get the longest pattern in the sig */
|
|
|
|
if (!fast_pattern) {
|
|
|
|
if (!fast_pattern) {
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
@ -409,12 +411,26 @@ void EngineAnalysisFastPattern(Signature *s)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
DetectContentData *cd = (DetectContentData *)sm->ctx;
|
|
|
|
DetectContentData *cd = (DetectContentData *)sm->ctx;
|
|
|
|
if (max_len < cd->content_len)
|
|
|
|
if (cd->flags & DETECT_CONTENT_NEGATED) {
|
|
|
|
max_len = cd->content_len;
|
|
|
|
if (max_len_negated < cd->content_len)
|
|
|
|
|
|
|
|
max_len_negated = cd->content_len;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (max_len_non_negated < cd->content_len)
|
|
|
|
|
|
|
|
max_len_non_negated = cd->content_len;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int skip_negated_content = 0;
|
|
|
|
|
|
|
|
if (max_len_non_negated == 0) {
|
|
|
|
|
|
|
|
max_len = max_len_negated;
|
|
|
|
|
|
|
|
skip_negated_content = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
max_len = max_len_non_negated;
|
|
|
|
|
|
|
|
skip_negated_content = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
SigMatch *sm = NULL;
|
|
|
|
for (list_id = 0; list_id < DETECT_SM_LIST_MAX; list_id++) {
|
|
|
|
for (list_id = 0; list_id < DETECT_SM_LIST_MAX; list_id++) {
|
|
|
|
if (!FastPatternSupportEnabledForSigMatchList(list_id))
|
|
|
|
if (!FastPatternSupportEnabledForSigMatchList(list_id))
|
|
|
|
@ -437,6 +453,8 @@ void EngineAnalysisFastPattern(Signature *s)
|
|
|
|
SCLogDebug("fast pattern %"PRIu32"", cd->id);
|
|
|
|
SCLogDebug("fast pattern %"PRIu32"", cd->id);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
DetectContentData *cd = (DetectContentData *)sm->ctx;
|
|
|
|
DetectContentData *cd = (DetectContentData *)sm->ctx;
|
|
|
|
|
|
|
|
if ((cd->flags & DETECT_CONTENT_NEGATED) && skip_negated_content)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
if (cd->content_len < max_len)
|
|
|
|
if (cd->content_len < max_len)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|