detect: Add negated MPM to non-MPM array

Treat negated MPM sigs as if non-MPM, so we consider them always.

As MPM results and non-MPM rules lists are now merged and considered
for further inspection, rules that need to be considerd when a pattern
is absent are caught in the middle.

As a HACK/workaround this patch adds them to the non-MPM list. This
causes them to be inspected each time.
pull/1295/head
Victor Julien 11 years ago
parent f5df526f9b
commit 1f57e25c03

@ -1721,6 +1721,8 @@ int SigGroupHeadBuildNonMpmArray(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
if (s->mpm_sm == NULL) if (s->mpm_sm == NULL)
non_mpm++; non_mpm++;
else if (s->flags & (SIG_FLAG_MPM_PACKET_NEG|SIG_FLAG_MPM_STREAM_NEG|SIG_FLAG_MPM_APPLAYER_NEG))
non_mpm++;
} }
if (non_mpm == 0) { if (non_mpm == 0) {
@ -1736,11 +1738,14 @@ int SigGroupHeadBuildNonMpmArray(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
s = sgh->match_array[sig]; s = sgh->match_array[sig];
if (s == NULL) if (s == NULL)
continue; continue;
if (s->mpm_sm != NULL)
continue;
BUG_ON(sgh->non_mpm_id_cnt >= non_mpm); if (s->mpm_sm == NULL) {
sgh->non_mpm_id_array[sgh->non_mpm_id_cnt++] = s->num; BUG_ON(sgh->non_mpm_id_cnt >= non_mpm);
sgh->non_mpm_id_array[sgh->non_mpm_id_cnt++] = s->num;
} else if (s->flags & (SIG_FLAG_MPM_PACKET_NEG|SIG_FLAG_MPM_STREAM_NEG|SIG_FLAG_MPM_APPLAYER_NEG)) {
BUG_ON(sgh->non_mpm_id_cnt >= non_mpm);
sgh->non_mpm_id_array[sgh->non_mpm_id_cnt++] = s->num;
}
} }
return 0; return 0;
} }

Loading…
Cancel
Save